Class: SPAttribute
- Inherits:
-
Object
- Object
- SPAttribute
- Defined in:
- lib/seek_party/models/sp_attribute.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
Instance Method Summary collapse
- #add_attribute(attribute) ⇒ Object
- #get_full_column_name(attribute) ⇒ Object
-
#initialize(attributes: [], table_name: nil) ⇒ SPAttribute
constructor
A new instance of SPAttribute.
Constructor Details
#initialize(attributes: [], table_name: nil) ⇒ SPAttribute
Returns a new instance of SPAttribute.
4 5 6 7 |
# File 'lib/seek_party/models/sp_attribute.rb', line 4 def initialize(attributes: [], table_name: nil) @attributes = attributes @table_name = table_name end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
2 3 4 |
# File 'lib/seek_party/models/sp_attribute.rb', line 2 def attributes @attributes end |
#table_name ⇒ Object
Returns the value of attribute table_name.
2 3 4 |
# File 'lib/seek_party/models/sp_attribute.rb', line 2 def table_name @table_name end |
Instance Method Details
#add_attribute(attribute) ⇒ Object
9 10 11 |
# File 'lib/seek_party/models/sp_attribute.rb', line 9 def add_attribute(attribute) @attributes << attribute end |
#get_full_column_name(attribute) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/seek_party/models/sp_attribute.rb', line 13 def get_full_column_name(attribute) if @attributes.include? attribute "#{@table_name}.#{attribute}" else raise 'Attribute not present in the attribute list.' end end |