Class: Tablesmith::Column

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Column

Returns a new instance of Column.



140
141
142
143
144
# File 'lib/tablesmith/table.rb', line 140

def initialize(attributes = {})
  @source = attributes.delete(:source)
  @name = attributes.delete(:name)
  @alias = attributes.delete(:alias)
end

Instance Attribute Details

#aliasObject

Returns the value of attribute alias.



138
139
140
# File 'lib/tablesmith/table.rb', line 138

def alias
  @alias
end

#nameObject

Returns the value of attribute name.



138
139
140
# File 'lib/tablesmith/table.rb', line 138

def name
  @name
end

#sourceObject

Returns the value of attribute source.



138
139
140
# File 'lib/tablesmith/table.rb', line 138

def source
  @source
end

Instance Method Details

#display_nameObject



146
147
148
# File 'lib/tablesmith/table.rb', line 146

def display_name
  (@alias || @name).to_s
end

#full_unaliased_nameObject



150
151
152
# File 'lib/tablesmith/table.rb', line 150

def full_unaliased_name
  "#{@source ? "#{@source}." : ''}#{@name}"
end

#to_sObject



154
155
156
# File 'lib/tablesmith/table.rb', line 154

def to_s
  "#{@source}.#{@name}#{' as ' + @alias if @alias}"
end