Class: LimitClause

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(num = nil) ⇒ LimitClause

Returns a new instance of LimitClause.



4
5
6
# File 'lib/activeleopard/query_clauses/limit_clause.rb', line 4

def initialize(num = nil)
  @num = num
end

Instance Attribute Details

#numObject (readonly)

Returns the value of attribute num.



2
3
4
# File 'lib/activeleopard/query_clauses/limit_clause.rb', line 2

def num
  @num
end

Instance Method Details

#as_sqlObject



8
9
10
# File 'lib/activeleopard/query_clauses/limit_clause.rb', line 8

def as_sql
  num.nil? ? "" : "LIMIT #{num} "
end

#set(n) ⇒ Object



12
13
14
# File 'lib/activeleopard/query_clauses/limit_clause.rb', line 12

def set(n)
  @num = n
end