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

Constant Summary

Constants inherited from Relation

Relation::NOOP_OUTPUT_SCHEMA

Instance Attribute Summary

Attributes inherited from Relation

#associations, #auto_map, #auto_struct, #commands, #config, #dataset, #datasets, #inflector, #input_schema, #mappers, #meta, #name, #output_schema, #registry, #schema, #schemas, #struct_namespace

Instance Method Summary collapse

Methods inherited from Relation

#[], #adapter, #as, #attr_ast, #auto_map?, #auto_struct?, #call, #combine, #combine_with, #curried?, #each, #eager_load, #foreign_key, #gateway, #graph?, inherited, #map_to, #map_with, #mapper, #meta_ast, new, #new, #node, #nodes, #preload_assoc, #schema?, setting_mapping, #to_a, #to_ast, view_methods, #with, #wrap, #wrap?, #wrap_around

Methods included from Plugins::ClassMethods

#plugins, #use

Methods included from Initializer

extended

Methods included from Relation::ClassInterface

#[], #curried, #forward

Methods included from Notifications::Listener

#subscribe

Methods included from AutoCurry

#auto_curried_methods, #auto_curry, #auto_curry_busy?, #auto_curry_guard, extended

Methods included from Pipeline

#map_with

Methods included from Pipeline::Operator

#>>

Methods included from Relation::Materializable

#each, #first, #one, #one!, #to_a

Methods included from Relation::Commands

#command

Instance Method Details

#delete(*args) ⇒ Relation

Delete tuples from the relation

Examples:

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

Returns:



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

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:



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

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

#join(*args) ⇒ Relation

Returns:

See Also:



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

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

#order(*fields) ⇒ Relation

Returns:

See Also:



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

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:



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

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

#rename(mapping) ⇒ Object

Rename attributes in a relation



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

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

#restrict(criteria = nil) ⇒ Relation

Returns:

See Also:



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

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

#take(amount) ⇒ Relation

Returns:

See Also:

  • Dataset#take


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

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