Class: Serega::AttributeValueResolvers::HashAccessDelegate

Inherits:
Object
  • Object
show all
Defined in:
lib/serega/attribute_value_resolvers/hash_access.rb

Overview

Value resolver for attributes with :hash_access and :delegate (without :allow_nil) options

Instance Method Summary collapse

Constructor Details

#initialize(to_step, final_step) ⇒ HashAccessDelegate

Returns a new instance of HashAccessDelegate.



81
82
83
84
# File 'lib/serega/attribute_value_resolvers/hash_access.rb', line 81

def initialize(to_step, final_step)
  @to_step = to_step
  @final_step = final_step
end

Instance Method Details

#call(object) ⇒ Object

Delegates the value reading through the intermediate object

Parameters:

  • object (Object)

    serialized object

Returns:

  • (Object)

    the value found



92
93
94
# File 'lib/serega/attribute_value_resolvers/hash_access.rb', line 92

def call(object)
  @final_step.call(@to_step.call(object))
end