Class: FlatMap::Mapping::Writer::Proc

Inherits:
Method show all
Defined in:
lib/flat_map/mapping/writer/proc.rb

Overview

Proc writer calls a lambda passed on the mapping definition and sends the mapper’s target and value to it.

Note that this doesn’t set anything on the target itself.

Instance Attribute Summary

Attributes inherited from Basic

#mapping

Instance Method Summary collapse

Methods inherited from Method

#initialize

Methods inherited from Basic

#initialize

Constructor Details

This class inherits a constructor from FlatMap::Mapping::Writer::Method

Instance Method Details

#write(value) ⇒ Object

Call a @method, which is a Proc object, passing it the mapping’s target and value.

Parameters:

  • value (Object)

Returns:

  • (Object)

    result of writing



13
14
15
# File 'lib/flat_map/mapping/writer/proc.rb', line 13

def write(value)
  @method.call(target, value)
end