Class: Serega::AttributeValueResolvers::HashAccessResolver

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

Overview

Builds value resolver for attributes with the :hash_access option

Constant Summary collapse

MODES =

Allowed hash access modes

%i[symbol string].freeze

Class Method Summary collapse

Class Method Details

.get(name, mode, allow_missing_key) ⇒ HashAccessKeyword

Creates resolver that reads a key from Hash records

Parameters:

  • name (Symbol, String)

    hash key

  • mode (Symbol)

    hash access mode (:symbol, :string)

  • allow_missing_key (Boolean)

    whether a missing key is read via record[key] rather than raising

Returns:



23
24
25
# File 'lib/serega/attribute_value_resolvers/hash_access.rb', line 23

def self.get(name, mode, allow_missing_key)
  HashAccessKeyword.new(name, mode, allow_missing_key)
end