Module: Serega::SeregaAttributeNormalizer::AttributeNormalizerInstanceMethods
- Included in:
- Serega::SeregaAttributeNormalizer
- Defined in:
- lib/serega/attribute_normalizer.rb
Overview
AttributeNormalizer instance methods
Instance Attribute Summary collapse
-
#init_block ⇒ Hash
readonly
Attribute initial params.
-
#init_name ⇒ Hash
readonly
Attribute initial params.
-
#init_opts ⇒ Hash
readonly
Attribute initial params.
Instance Method Summary collapse
-
#hide ⇒ Boolean?
Shows if attribute is specified to be hidden.
-
#initialize(initials) ⇒ SeregaAttributeNormalizer
Instantiates attribute options normalizer.
-
#key ⇒ Symbol
Symbolized initial attribute key or attribute name if key is empty.
-
#many ⇒ Boolean?
Shows if attribute is specified to be a one-to-many relationship.
-
#name ⇒ Symbol
Symbolized initial attribute name.
-
#serializer ⇒ Serega, ...
Shows specified attribute serializer.
-
#value_block ⇒ #call
Combines all options to return single block that will be used to find attribute value during serialization.
Instance Attribute Details
#init_block ⇒ Hash (readonly)
Attribute initial params
14 15 16 |
# File 'lib/serega/attribute_normalizer.rb', line 14 def init_block @init_block end |
#init_name ⇒ Hash (readonly)
Attribute initial params
14 15 16 |
# File 'lib/serega/attribute_normalizer.rb', line 14 def init_name @init_name end |
#init_opts ⇒ Hash (readonly)
Attribute initial params
14 15 16 |
# File 'lib/serega/attribute_normalizer.rb', line 14 def init_opts @init_opts end |
Instance Method Details
#hide ⇒ Boolean?
Shows if attribute is specified to be hidden
62 63 64 65 66 |
# File 'lib/serega/attribute_normalizer.rb', line 62 def hide return @hide if instance_variable_defined?(:@hide) @hide = prepare_hide end |
#initialize(initials) ⇒ SeregaAttributeNormalizer
Instantiates attribute options normalizer
23 24 25 26 27 |
# File 'lib/serega/attribute_normalizer.rb', line 23 def initialize(initials) @init_name = initials[:name] @init_opts = initials[:opts] @init_block = initials[:block] end |
#key ⇒ Symbol
Symbolized initial attribute key or attribute name if key is empty
43 44 45 |
# File 'lib/serega/attribute_normalizer.rb', line 43 def key @key ||= prepare_key end |
#many ⇒ Boolean?
Shows if attribute is specified to be a one-to-many relationship
73 74 75 76 77 |
# File 'lib/serega/attribute_normalizer.rb', line 73 def many return @many if instance_variable_defined?(:@many) @many = prepare_many end |
#name ⇒ Symbol
Symbolized initial attribute name
34 35 36 |
# File 'lib/serega/attribute_normalizer.rb', line 34 def name @name ||= prepare_name end |
#serializer ⇒ Serega, ...
Shows specified attribute serializer
83 84 85 86 87 |
# File 'lib/serega/attribute_normalizer.rb', line 83 def serializer return @serializer if instance_variable_defined?(:@serializer) @serializer = prepare_serializer end |
#value_block ⇒ #call
Combines all options to return single block that will be used to find attribute value during serialization
53 54 55 |
# File 'lib/serega/attribute_normalizer.rb', line 53 def value_block @value_block ||= prepare_value_block end |