Class: ROM::Session::Environment

Inherits:
Environment show all
Includes:
Proxy
Defined in:
lib/rom/session/environment.rb

Overview

Session-specific environment wrapping ROM’s environment

It works exactly the same as ROM::Environment except it returns session relations

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Proxy

included

Methods inherited from Environment

#session

Constructor Details

#initialize(environment, tracker) ⇒ Environment

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.

Returns a new instance of Environment.



24
25
26
27
28
# File 'lib/rom/session/environment.rb', line 24

def initialize(environment, tracker)
  @environment = environment
  @tracker     = tracker
  initialize_memory
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ROM::Proxy

Class Method Details

.build(environment, tracker = Tracker.new) ⇒ Object

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.



19
20
21
# File 'lib/rom/session/environment.rb', line 19

def self.build(environment, tracker = Tracker.new)
  new(environment, tracker)
end

Instance Method Details

#[](name) ⇒ Session::Relation

Return a relation identified by name

Parameters:

  • name (Symbol)

    of a relation

Returns:



37
38
39
# File 'lib/rom/session/environment.rb', line 37

def [](name)
  memory[name]
end

#clean?Boolean

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.

Returns:

  • (Boolean)


47
48
49
# File 'lib/rom/session/environment.rb', line 47

def clean?
  tracker.clean?
end

#commitObject

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.



42
43
44
# File 'lib/rom/session/environment.rb', line 42

def commit
  tracker.commit
end