Class: HashMapAttributes::AttributeContainer
- Inherits:
-
Object
- Object
- HashMapAttributes::AttributeContainer
- Defined in:
- lib/hash_map_attributes.rb
Instance Attribute Summary collapse
-
#allow_nil ⇒ Object
readonly
Returns the value of attribute allow_nil.
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(attribute, to, prefix, allow_nil) ⇒ AttributeContainer
constructor
A new instance of AttributeContainer.
Constructor Details
#initialize(attribute, to, prefix, allow_nil) ⇒ AttributeContainer
Returns a new instance of AttributeContainer.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hash_map_attributes.rb', line 10 def initialize(attribute, to, prefix, allow_nil) @to = to.to_s @prefix = \ if prefix "#{prefix == true ? to : prefix}_" else '' end @attribute = attribute.to_s @allow_nil = allow_nil @method_name = "#{@prefix}#{@attribute}" end |
Instance Attribute Details
#allow_nil ⇒ Object (readonly)
Returns the value of attribute allow_nil.
9 10 11 |
# File 'lib/hash_map_attributes.rb', line 9 def allow_nil @allow_nil end |
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
9 10 11 |
# File 'lib/hash_map_attributes.rb', line 9 def attribute @attribute end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
9 10 11 |
# File 'lib/hash_map_attributes.rb', line 9 def method_name @method_name end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
9 10 11 |
# File 'lib/hash_map_attributes.rb', line 9 def prefix @prefix end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
9 10 11 |
# File 'lib/hash_map_attributes.rb', line 9 def to @to end |