Class: Arel::Array
- Inherits:
-
Object
- Object
- Arel::Array
- Includes:
- Recursion::BaseCase, Relation
- Defined in:
- lib/arel/engines/memory/relations/array.rb
Instance Attribute Summary
Attributes included from Relation
Instance Method Summary collapse
- #attributes ⇒ Object
- #engine ⇒ Object
- #eval ⇒ Object
- #format(attribute, value) ⇒ Object
-
#initialize(array, attribute_names_and_types) ⇒ Array
constructor
A new instance of Array.
Methods included from Recursion::BaseCase
Methods included from Relation
#bind, #call, #christener, #compiler, #exclusion_predicate_sql, #externalizable?, #externalize, #inclusion_predicate_sql, #join?, #primary_key, #session, #to_sql
Methods included from Relation::DefaultOperations
#groupings, #havings, #inserts, #joins, #locked, #orders, #projections, #skipped, #sources, #taken, #wheres
Methods included from Relation::AttributeAccessable
#[], #find_attribute_matching_attribute, #find_attribute_matching_name, #position_of
Methods included from Relation::Operable
#alias, #join, #lock, #outer_join
Methods included from Relation::Operable::Writable
Methods included from Relation::Enumerable
Constructor Details
#initialize(array, attribute_names_and_types) ⇒ Array
Returns a new instance of Array.
9 10 11 |
# File 'lib/arel/engines/memory/relations/array.rb', line 9 def initialize(array, attribute_names_and_types) @array, @attribute_names_and_types = array, attribute_names_and_types end |
Instance Method Details
#attributes ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/arel/engines/memory/relations/array.rb', line 17 def attributes @attributes ||= begin attrs = @attribute_names_and_types.collect do |attribute, type| attribute = type.new(self, attribute) if Symbol === attribute attribute end Header.new(attrs) end end |
#engine ⇒ Object
13 14 15 |
# File 'lib/arel/engines/memory/relations/array.rb', line 13 def engine @engine ||= Memory::Engine.new end |
#eval ⇒ Object
31 32 33 |
# File 'lib/arel/engines/memory/relations/array.rb', line 31 def eval @array.collect { |r| Row.new(self, r) } end |
#format(attribute, value) ⇒ Object
27 28 29 |
# File 'lib/arel/engines/memory/relations/array.rb', line 27 def format(attribute, value) value end |