Module: ROM::Relation::Materializable

Included in:
ROM::Relation, Composite, Curried, Graph
Defined in:
lib/rom/relation/materializable.rb

Overview

Interface for objects that can be materialized into a loaded relation

Instance Method Summary collapse

Instance Method Details

#each {|Hash, Object| ... } ⇒ Object

Yield relation tuples

Yields:

  • (Hash, Object)


22
23
24
25
26
# File 'lib/rom/relation/materializable.rb', line 22

def each(&)
  return to_enum unless block_given?

  to_a.each(&)
end

#firstObject

Return first tuple from a relation coerced to an array

Returns:

  • (Object)


51
# File 'lib/rom/relation/materializable.rb', line 51

def first = to_a.first

#oneObject

Delegate to loaded relation and return one object

Returns:

  • (Object)

See Also:



35
# File 'lib/rom/relation/materializable.rb', line 35

def one = call.one

#one!Object

Delegate to loaded relation and return one object

Returns:

  • (Object)

See Also:



44
# File 'lib/rom/relation/materializable.rb', line 44

def one! = call.one!

#to_aArray Also known as: to_ary

Coerce the relation to an array

Returns:

  • (Array)


14
# File 'lib/rom/relation/materializable.rb', line 14

def to_a = call.to_a