Class: Break::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/break/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(binding, frontend:) ⇒ Session

Returns a new instance of Session.



8
9
10
11
# File 'lib/break/session.rb', line 8

def initialize(binding, frontend:)
  @contexts = [Context.new(binding)]
  @frontend = frontend
end

Instance Attribute Details

#contextsObject (readonly)

Returns the value of attribute contexts.



5
6
7
# File 'lib/break/session.rb', line 5

def contexts
  @contexts
end

#frontendObject (readonly)

Returns the value of attribute frontend.



6
7
8
# File 'lib/break/session.rb', line 6

def frontend
  @frontend
end

Instance Method Details

#contextObject



21
22
23
# File 'lib/break/session.rb', line 21

def context
  contexts.last
end

#context!(*bindings, depth: 0) ⇒ Object



25
26
27
28
# File 'lib/break/session.rb', line 25

def context!(*bindings, depth: 0)
  contexts << Context.new(*bindings, depth: depth)
  enter
end

#enterObject



13
14
15
# File 'lib/break/session.rb', line 13

def enter
  frontend.attach(self)
end

#leaveObject



17
18
19
# File 'lib/break/session.rb', line 17

def leave
  frontend.detach
end