Module: RecordLens
- Defined in:
- lib/ruby-optics/record/record_lens.rb
Class Method Summary collapse
Class Method Details
.build(attribute_name) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/ruby-optics/record/record_lens.rb', line 4 def self.build(attribute_name) Lens.new( -> (record) { record.send(attribute_name) }, -> (new_attr_value, record) { record.copy_with(attribute_name => new_attr_value) } ) end |