Skip to content

Commit

Permalink
Released v0.2.0
Browse files Browse the repository at this point in the history
## Changed

- For almost any method called on a decorated object, both its result
  and `yield`ed arguments get decorated.
  Some methods aren’t meant to be decorated though:
  - `deconstruct` & `deconstruct_keys` for _pattern matching_,
  - _converting_ methods: those starting with `to_`,
  - _system_ methods: those starting with `_`.

## Added

- `Magic::Decorator::Base.undecorated` to exclude methods from being
  decorated automagically.

### Default decorators

- `EnumerableDecorator` to decorate `Enumerable`s.
  - enables _splat_ operator: `*decorated` ,
  - enables _double-splat_ operator: `**decorated`,
  - enumerating methods yield decorated items.
  • Loading branch information
Alexander-Senko committed Oct 17, 2024
1 parent ba8b399 commit 76b6ce5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## [0.2.0]UNRELEASED
## [0.2.0]2024-10-17

### Changed

Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ person.name # => "John Smith"
This module adds three methods to decorate an object.
Decorator class is being inferred automatically.
When no decorator is found,
* `#decorate` returns `nil`,
* `#decorate!` raises `Magic::Lookup::Error`,
* `#decorated` returns the original object.
- `#decorate` returns `nil`,
- `#decorate!` raises `Magic::Lookup::Error`,
- `#decorated` returns the original object.

One can test for the object is actually decorated with `#decorated?`.

Expand All @@ -60,9 +60,11 @@ One can test for the object is actually decorated with `#decorated?`.
.decorated? # => true
```

#### Magic
## Magic

`Decoratable` is mixed into `Object` by default. That means that effectively any object is `Decoratable`.
### Decoratable scope

`Magic::Decoratable` is mixed into `Object` by default. It means that effectively any object is _magically decoratable_.

### Decoration expansion

Expand Down
2 changes: 1 addition & 1 deletion lib/magic/decorator/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Magic
module Decorator
VERSION = '0.2.0.alpha'
VERSION = '0.2.0'
end
end

0 comments on commit 76b6ce5

Please sign in to comment.