Class: Trinidad::WebApp::Holder
- Inherits:
-
Object
- Object
- Trinidad::WebApp::Holder
- Defined in:
- lib/trinidad/web_app.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#monitor_mtime ⇒ Object
Returns the value of attribute monitor_mtime.
-
#web_app ⇒ Object
readonly
Returns the value of attribute web_app.
Instance Method Summary collapse
-
#[](key) ⇒ Object
deprecated
Deprecated.
behaves Hash like for (<= 1.3.5) compatibility
-
#[]=(key, val) ⇒ Object
deprecated
Deprecated.
behaves Hash like for (<= 1.3.5) compatibility
-
#initialize(web_app, context) ⇒ Holder
constructor
A new instance of Holder.
- #lock ⇒ Object
- #locked? ⇒ Boolean
- #monitor ⇒ Object
- #try_lock ⇒ Object
- #unlock ⇒ Object
Constructor Details
#initialize(web_app, context) ⇒ Holder
Returns a new instance of Holder.
235 236 237 |
# File 'lib/trinidad/web_app.rb', line 235 def initialize(web_app, context) @web_app, @context = web_app, context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
240 241 242 |
# File 'lib/trinidad/web_app.rb', line 240 def context @context end |
#monitor_mtime ⇒ Object
Returns the value of attribute monitor_mtime.
244 245 246 |
# File 'lib/trinidad/web_app.rb', line 244 def monitor_mtime @monitor_mtime end |
#web_app ⇒ Object (readonly)
Returns the value of attribute web_app.
239 240 241 |
# File 'lib/trinidad/web_app.rb', line 239 def web_app @web_app end |
Instance Method Details
#[](key) ⇒ Object
Deprecated.
behaves Hash like for (<= 1.3.5) compatibility
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/trinidad/web_app.rb', line 255 def [](key) case key.to_sym when :app then web_app when :context then context when :lock then @lock when :monitor then monitor when :mtime then monitor_mtime else raise NoMethodError, key.to_s end end |
#[]=(key, val) ⇒ Object
Deprecated.
behaves Hash like for (<= 1.3.5) compatibility
272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/trinidad/web_app.rb', line 272 def []=(key, val) case key.to_sym when :context then self.context=(val) when :lock then @lock = val when :mtime then self.monitor_mtime=(val) else raise NoMethodError, "#{key}=" end end |
#lock ⇒ Object
251 |
# File 'lib/trinidad/web_app.rb', line 251 def lock; @lock = true; end |
#locked? ⇒ Boolean
250 |
# File 'lib/trinidad/web_app.rb', line 250 def locked?; !!@lock; end |
#monitor ⇒ Object
242 |
# File 'lib/trinidad/web_app.rb', line 242 def monitor; web_app.monitor; end |
#try_lock ⇒ Object
246 247 248 |
# File 'lib/trinidad/web_app.rb', line 246 def try_lock locked? ? false : lock end |
#unlock ⇒ Object
252 |
# File 'lib/trinidad/web_app.rb', line 252 def unlock; @lock = false; end |