Class: GroupClause

Inherits:
Object show all
Defined in:
lib/activeleopard/query_clauses/group_clause.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_attrObject

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_sqlObject



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