Class: Tablesmith::Column
- Inherits:
-
Object
- Object
- Tablesmith::Column
- Defined in:
- lib/tablesmith/table.rb
Instance Attribute Summary collapse
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#name ⇒ Object
Returns the value of attribute name.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #display_name ⇒ Object
- #full_unaliased_name ⇒ Object
-
#initialize(attributes = {}) ⇒ Column
constructor
A new instance of Column.
- #to_s ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Column
Returns a new instance of Column.
151 152 153 154 155 |
# File 'lib/tablesmith/table.rb', line 151 def initialize(attributes = {}) @source = attributes.delete(:source) @name = attributes.delete(:name) @alias = attributes.delete(:alias) end |
Instance Attribute Details
#alias ⇒ Object
Returns the value of attribute alias.
149 150 151 |
# File 'lib/tablesmith/table.rb', line 149 def alias @alias end |
#name ⇒ Object
Returns the value of attribute name.
149 150 151 |
# File 'lib/tablesmith/table.rb', line 149 def name @name end |
#source ⇒ Object
Returns the value of attribute source.
149 150 151 |
# File 'lib/tablesmith/table.rb', line 149 def source @source end |
Instance Method Details
#display_name ⇒ Object
157 158 159 |
# File 'lib/tablesmith/table.rb', line 157 def display_name (@alias || @name).to_s end |
#full_unaliased_name ⇒ Object
161 162 163 |
# File 'lib/tablesmith/table.rb', line 161 def full_unaliased_name "#{@source ? "#{@source}." : ''}#{@name}" end |
#to_s ⇒ Object
165 166 167 |
# File 'lib/tablesmith/table.rb', line 165 def to_s "#{@source}.#{@name}#{' as ' + @alias if @alias}" end |