mustmodify / valuable

quick ruby modeling -- basically attr_accessor with default values, light-weight casting, and a constructor
http://valuable.mustmodify.com/
MIT License
72 stars 3 forks source link

attributes hash assumes symbols, fails with strings, pretty dumb #29

Open mustmodify opened 6 years ago

mustmodify commented 6 years ago
class Fu < Valuable
  has_value :bar
end

>> f = Fu.new(bar: 6)

>> f.attributes['bar']
=> nil

>> f.attributes[:bar]
=> 6
mustmodify commented 4 years ago

Well, in order to get this to work, we'd need something like HashWithIndifferentAccess. Alternately, we could make this work for JUST attributes but not, for example, f.attributes['fu']['bar']. So ... 🤷‍♂