anima
anima copied to clipboard
Object initializer from attributes hash
## Summary This branch changes Anima::InstanceMethods#to_h to accept an optional block. This behaviour is similar to Hash#to_h in Ruby 2.6+. ## Changes - Change Anima::InstanceMethods#to_h to accept a block
- This is more symmetric with `Attribute#set` that is backed by `Object#instance_variable_set - Ultimatively we later want to use `#instance_variable_set` but that would be a breaking change as currently overwritten...
- Equalizer needs to access the attributes, hence protected is the most restrictive default
``` ruby require 'anima' Anima::VERSION # => "0.4.2" class Dog include Anima.new(:name, :age, :breed) private :breed end spot = Dog.new(name: 'Spot', age: 5, breed: 'Dalmatian') spot # => # spot.with(age:...
I do not think this library is missing anything. I'm at all for releasing an `1.0` version. Feel free to add your comment here to discuss. EDIT: I think #3...