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.
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
#alias ⇒ Object
Returns the value of attribute alias.
138 139 140 |
# File 'lib/tablesmith/table.rb', line 138 def alias @alias end |
#name ⇒ Object
Returns the value of attribute name.
138 139 140 |
# File 'lib/tablesmith/table.rb', line 138 def name @name end |
#source ⇒ Object
Returns the value of attribute source.
138 139 140 |
# File 'lib/tablesmith/table.rb', line 138 def source @source end |
Instance Method Details
#display_name ⇒ Object
146 147 148 |
# File 'lib/tablesmith/table.rb', line 146 def display_name (@alias || @name).to_s end |
#full_unaliased_name ⇒ Object
150 151 152 |
# File 'lib/tablesmith/table.rb', line 150 def full_unaliased_name "#{@source ? "#{@source}." : ''}#{@name}" end |
#to_s ⇒ Object
154 155 156 |
# File 'lib/tablesmith/table.rb', line 154 def to_s "#{@source}.#{@name}#{' as ' + @alias if @alias}" end |