Class: HashMapAttributes::AttributeContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/hash_map_attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nilObject (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

#attributeObject (readonly)

Returns the value of attribute attribute.



9
10
11
# File 'lib/hash_map_attributes.rb', line 9

def attribute
  @attribute
end

#method_nameObject (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

#prefixObject (readonly)

Returns the value of attribute prefix.



9
10
11
# File 'lib/hash_map_attributes.rb', line 9

def prefix
  @prefix
end

#toObject (readonly)

Returns the value of attribute to.



9
10
11
# File 'lib/hash_map_attributes.rb', line 9

def to
  @to
end