Class: Serega::AttributeValueResolvers::HashAccessDelegateResolver

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

Overview

Builds value resolver for attributes with the :delegate option using hash access on any of its steps

Class Method Summary collapse

Class Method Details

.get(to_step, final_step, delegate_allow_nil) ⇒ HashAccessDelegate, HashAccessDelegateAllowNil

Creates resolver that delegates through the provided step readers

Parameters:

  • to_step (#call)

    reader of the intermediate object

  • final_step (#call)

    reader of the final value

  • delegate_allow_nil (Boolean)

    whether a nil intermediate object resolves to nil

Returns:



43
44
45
# File 'lib/serega/attribute_value_resolvers/hash_access.rb', line 43

def self.get(to_step, final_step, delegate_allow_nil)
  delegate_allow_nil ? HashAccessDelegateAllowNil.new(to_step, final_step) : HashAccessDelegate.new(to_step, final_step)
end