class ROM::Session::Environment
Session-specific environment wrapping ROM’s environment
It works exactly the same as ROM::Environment
except it returns session relations
@api public
Attributes
environment[R]
memory[R]
tracker[R]
Public Class Methods
build(environment, tracker = Tracker.new)
click to toggle source
@api private
# File lib/rom/session/environment.rb, line 19 def self.build(environment, tracker = Tracker.new) new(environment, tracker) end
new(environment, tracker)
click to toggle source
@api private
# File lib/rom/session/environment.rb, line 24 def initialize(environment, tracker) @environment = environment @tracker = tracker initialize_memory end
Public Instance Methods
[](name)
click to toggle source
Return a relation identified by name
@param [Symbol] name of a relation
@return [Session::Relation] rom’s relation wrapped by session
@api public
# File lib/rom/session/environment.rb, line 37 def [](name) memory[name] end
clean?()
click to toggle source
@api private
# File lib/rom/session/environment.rb, line 47 def clean? tracker.clean? end
commit()
click to toggle source
@api private
# File lib/rom/session/environment.rb, line 42 def commit tracker.commit end
Private Instance Methods
build_relation(name)
click to toggle source
@api private
# File lib/rom/session/environment.rb, line 59 def build_relation(name) Relation.build(environment[name], tracker) end
initialize_memory()
click to toggle source
@api private
# File lib/rom/session/environment.rb, line 54 def initialize_memory @memory = Hash.new { |_, name| memory[name] = build_relation(name) } end