Class: ParamsDeserializer::Attribute
- Inherits:
-
Object
- Object
- ParamsDeserializer::Attribute
- Defined in:
- lib/params_deserializers/attribute.rb
Instance Attribute Summary collapse
-
#ignored ⇒ Object
readonly
Returns the value of attribute ignored.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#original_name ⇒ Object
readonly
Returns the value of attribute original_name.
-
#present_if ⇒ Object
readonly
Returns the value of attribute present_if.
Instance Method Summary collapse
-
#initialize(original_name, options = {}) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(original_name, options = {}) ⇒ Attribute
Returns a new instance of Attribute.
34 35 36 37 38 39 |
# File 'lib/params_deserializers/attribute.rb', line 34 def initialize(original_name, = {}) @original_name = original_name @name = [:rename_to] || @original_name @ignored = [:ignored] @present_if = [:present_if] || -> { params_root.has_key?(original_name) } end |
Instance Attribute Details
#ignored ⇒ Object (readonly)
Returns the value of attribute ignored.
32 33 34 |
# File 'lib/params_deserializers/attribute.rb', line 32 def ignored @ignored end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/params_deserializers/attribute.rb', line 32 def name @name end |
#original_name ⇒ Object (readonly)
Returns the value of attribute original_name.
32 33 34 |
# File 'lib/params_deserializers/attribute.rb', line 32 def original_name @original_name end |
#present_if ⇒ Object (readonly)
Returns the value of attribute present_if.
32 33 34 |
# File 'lib/params_deserializers/attribute.rb', line 32 def present_if @present_if end |