Class: Arel::Take

Inherits:
Compound show all
Defined in:
lib/arel/algebra/relations/operations/take.rb

Instance Attribute Summary collapse

Attributes inherited from Compound

#engine, #relation

Attributes included from Relation

#count

Instance Method Summary collapse

Methods inherited from Compound

#attributes, #column_for, #join?, #joins, #name, #skipped, #sources, #table, #table_alias, #table_sql, #unoperated_rows

Methods included from Relation

#[], #alias, #attributes, #bind, #call, #christener, #compiler, #delete, #each, #exclusion_predicate_sql, #externalize, #find_attribute_matching_name, #from, #from_clauses, #group_clauses, #groupings, #having_clauses, #havings, #inclusion_predicate_sql, #insert, #inserts, #join, #join?, #joins, #lock, #locked, #order_clauses, #orders, #outer_join, #position_of, #primary_key, #project, #projections, #select_clauses, #session, #skip, #skipped, #sources, #take, #to_sql, #update, #where, #where_clauses, #wheres

Constructor Details

#initialize(relation, taken) ⇒ Take

Returns a new instance of Take.



5
6
7
8
# File 'lib/arel/algebra/relations/operations/take.rb', line 5

def initialize relation, taken
  super(relation)
  @taken = taken
end

Instance Attribute Details

#takenObject (readonly)

Returns the value of attribute taken.



3
4
5
# File 'lib/arel/algebra/relations/operations/take.rb', line 3

def taken
  @taken
end

Instance Method Details

#evalObject



14
15
16
# File 'lib/arel/algebra/relations/operations/take.rb', line 14

def eval
  unoperated_rows[0, taken]
end

#externalizable?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/arel/algebra/relations/operations/take.rb', line 10

def externalizable?
  true
end