Class: GroupClause
- Defined in:
- lib/activeleopard/query_clauses/group_clause.rb
Instance Attribute Summary collapse
-
#grouping_attr ⇒ Object
Returns the value of attribute grouping_attr.
Instance Method Summary collapse
- #as_sql ⇒ Object
-
#initialize(grouping_attr = nil) ⇒ GroupClause
constructor
A new instance of GroupClause.
Constructor Details
#initialize(grouping_attr = nil) ⇒ GroupClause
Returns a new instance of GroupClause.
4 5 6 |
# File 'lib/activeleopard/query_clauses/group_clause.rb', line 4 def initialize(grouping_attr = nil) @grouping_attr = grouping_attr end |
Instance Attribute Details
#grouping_attr ⇒ Object
Returns the value of attribute grouping_attr.
2 3 4 |
# File 'lib/activeleopard/query_clauses/group_clause.rb', line 2 def grouping_attr @grouping_attr end |
Instance Method Details
#as_sql ⇒ Object
8 9 10 11 |
# File 'lib/activeleopard/query_clauses/group_clause.rb', line 8 def as_sql return "" if grouping_attr.nil? "GROUP BY #{grouping_attr.to_s}" end |