Class: MetaWhere::Column
- Inherits:
-
Object
- Object
- MetaWhere::Column
- Defined in:
- lib/meta_where/column.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
- #%(value) ⇒ Object
- #==(other_column) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(column, method) ⇒ Column
constructor
A new instance of Column.
-
#to_sym ⇒ Object
Play nicely with expand_hash_conditions_for_aggregates.
Constructor Details
#initialize(column, method) ⇒ Column
5 6 7 8 |
# File 'lib/meta_where/column.rb', line 5 def initialize(column, method) @column = column @method = method end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
3 4 5 |
# File 'lib/meta_where/column.rb', line 3 def column @column end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
3 4 5 |
# File 'lib/meta_where/column.rb', line 3 def method @method end |
Instance Method Details
#%(value) ⇒ Object
10 11 12 |
# File 'lib/meta_where/column.rb', line 10 def %(value) MetaWhere::Condition.new(column, value, method) end |
#==(other_column) ⇒ Object Also known as: eql?
14 15 16 17 18 |
# File 'lib/meta_where/column.rb', line 14 def ==(other_column) other_column.is_a?(Column) && other_column.column == column && other_column.method == method end |
#hash ⇒ Object
22 23 24 |
# File 'lib/meta_where/column.rb', line 22 def hash [column, method].hash end |
#to_sym ⇒ Object
Play nicely with expand_hash_conditions_for_aggregates
27 28 29 |
# File 'lib/meta_where/column.rb', line 27 def to_sym "#{column}.#{method}".to_sym end |