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 behaves Hash like for (<= 1.3.5) compatibility.
-
#[]=(key, val) ⇒ Object
#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.
516 517 518 |
# File 'lib/trinidad/web_app.rb', line 516 def initialize(web_app, context) @web_app, @context = web_app, context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
521 522 523 |
# File 'lib/trinidad/web_app.rb', line 521 def context @context end |
#monitor_mtime ⇒ Object
Returns the value of attribute monitor_mtime.
525 526 527 |
# File 'lib/trinidad/web_app.rb', line 525 def monitor_mtime @monitor_mtime end |
#web_app ⇒ Object (readonly)
Returns the value of attribute web_app.
520 521 522 |
# File 'lib/trinidad/web_app.rb', line 520 def web_app @web_app end |
Instance Method Details
#[](key) ⇒ Object
#deprecated behaves Hash like for (<= 1.3.5) compatibility
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'lib/trinidad/web_app.rb', line 536 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
553 554 555 556 557 558 559 560 561 562 563 |
# File 'lib/trinidad/web_app.rb', line 553 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
532 |
# File 'lib/trinidad/web_app.rb', line 532 def lock; @lock = true; end |
#locked? ⇒ Boolean
531 |
# File 'lib/trinidad/web_app.rb', line 531 def locked?; !!@lock; end |
#monitor ⇒ Object
523 |
# File 'lib/trinidad/web_app.rb', line 523 def monitor; web_app.monitor; end |
#try_lock ⇒ Object
527 528 529 |
# File 'lib/trinidad/web_app.rb', line 527 def try_lock locked? ? false : lock end |
#unlock ⇒ Object
533 |
# File 'lib/trinidad/web_app.rb', line 533 def unlock; @lock = false; end |