Class: ActiveRecordCalculator::Column
- Inherits:
-
Object
- Object
- ActiveRecordCalculator::Column
- Defined in:
- lib/active_record_calculator/column.rb
Instance Method Summary collapse
- #alias_name ⇒ Object
- #build_select ⇒ Object
-
#initialize(name, as) ⇒ Column
constructor
A new instance of Column.
- #inspect ⇒ Object
Constructor Details
#initialize(name, as) ⇒ Column
Returns a new instance of Column.
4 5 6 7 |
# File 'lib/active_record_calculator/column.rb', line 4 def initialize(name, as) @name = name @as = as end |
Instance Method Details
#alias_name ⇒ Object
17 18 19 |
# File 'lib/active_record_calculator/column.rb', line 17 def alias_name @as.to_s end |
#build_select ⇒ Object
9 10 11 |
# File 'lib/active_record_calculator/column.rb', line 9 def build_select "#{@name} AS #{@as || @name}" end |
#inspect ⇒ Object
13 14 15 |
# File 'lib/active_record_calculator/column.rb', line 13 def inspect @name.to_s end |