Class: Arel::Nodes::LimitBy

Inherits:
Unary
  • Object
show all
Defined in:
lib/arel/nodes/limit_by.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limit, column) ⇒ LimitBy

Returns a new instance of LimitBy.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
# File 'lib/arel/nodes/limit_by.rb', line 6

def initialize(limit, column)
  raise ArgumentError, 'Limit should be an integer' unless limit.is_a?(Integer)
  raise ArgumentError, 'Limit should be a positive integer' unless limit >= 0
  raise ArgumentError, 'Column should be a Symbol or String' unless column.is_a?(String) || column.is_a?(Symbol)
  
  @column = column

  super(limit)
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



4
5
6
# File 'lib/arel/nodes/limit_by.rb', line 4

def column
  @column
end