Class: ROM::Memory::Relation

Inherits:
Relation show all
Includes:
Enumerable, ROM::Memory
Defined in:
lib/rom/memory/relation.rb

Overview

Relation subclass for memory adapter

Examples:

class Users < ROM::Relation[:memory]
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#__memoized__Object (readonly) Originally defined in module ROM::Memoizable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

#relation_nameObject (readonly) Originally defined in module Relation::ClassInterface

Raises:

#schema_procObject (readonly) Originally defined in module Relation::ClassInterface

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Instance Method Details

#delete(*args) ⇒ Relation

Delete tuples from the relation

Examples:

users.insert(name: 'Jane')
users.delete(name: 'Jane')

Returns:


84
85
86
87
# File 'lib/rom/memory/relation.rb', line 84

def delete(*args)
  dataset.delete(*args)
  self
end

#insert(*args) ⇒ Relation Also known as: <<

Insert tuples into the relation

Examples:

users.insert(name: 'Jane')

Returns:


69
70
71
72
# File 'lib/rom/memory/relation.rb', line 69

def insert(*args)
  dataset.insert(*args)
  self
end

#join(*args) ⇒ Relation

Returns:

See Also:


41
# File 'lib/rom/memory/relation.rb', line 41

forward :take, :join, :restrict, :order

#order(*fields) ⇒ Relation

Returns:

See Also:


41
# File 'lib/rom/memory/relation.rb', line 41

forward :take, :join, :restrict, :order

#project(*names) ⇒ Memory::Relation

Project a relation with provided attribute names

Parameters:

  • names (*Array)

    A list with attribute names

Returns:


50
51
52
# File 'lib/rom/memory/relation.rb', line 50

def project(*names)
  schema.project(*names).(self)
end

#rename(mapping) ⇒ Object

Rename attributes in a relation


57
58
59
# File 'lib/rom/memory/relation.rb', line 57

def rename(mapping)
  schema.rename(mapping).(self)
end

#restrict(criteria = nil) ⇒ Relation

Returns:

See Also:


41
# File 'lib/rom/memory/relation.rb', line 41

forward :take, :join, :restrict, :order

#take(amount) ⇒ Relation

Returns:

See Also:

  • Dataset#take

41
# File 'lib/rom/memory/relation.rb', line 41

forward :take, :join, :restrict, :order