Class: Tofu::Bartender

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(factory, name = nil) ⇒ Bartender

Returns a new instance of Bartender.



130
131
132
133
134
# File 'lib/tofu.rb', line 130

def initialize(factory, name=nil)
  @factory = factory
  @prefix = name ? name : factory.to_s.split(':')[-1]
  @bar = SessionBar.new
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



135
136
137
# File 'lib/tofu.rb', line 135

def prefix
  @prefix
end

Instance Method Details

#service(context) ⇒ Object



137
138
139
140
141
142
143
144
# File 'lib/tofu.rb', line 137

def service(context)
  begin
    session = retrieve_session(context)
    catch(:tofu_done) { session.service(context) }
    store_session(context, session)
  ensure
  end
end