Class: SPAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/seek_party/models/sp_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributesObject

Returns the value of attribute attributes.



2
3
4
# File 'lib/seek_party/models/sp_attribute.rb', line 2

def attributes
  @attributes
end

#table_nameObject

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