Class: Optics::HashLens
Instance Method Summary collapse
-
#initialize(key) ⇒ HashLens
constructor
A new instance of HashLens.
Methods inherited from Lens
Constructor Details
#initialize(key) ⇒ HashLens
Returns a new instance of HashLens.
29 30 31 32 33 34 |
# File 'lib/optics.rb', line 29 def initialize(key) super( -> (subject) { subject[key] }, -> (subject, value) { subject.merge(key => value) } ) end |