Class: Tofu::Bartender
- Inherits:
-
Object
- Object
- Tofu::Bartender
- Defined in:
- lib/tofu.rb
Instance Attribute Summary collapse
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
-
#initialize(factory, name = nil) ⇒ Bartender
constructor
A new instance of Bartender.
- #service(context) ⇒ Object
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
#prefix ⇒ Object (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 |