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.
596 597 598 |
# File 'lib/trinidad/web_app.rb', line 596 def initialize(web_app, context) @web_app, @context = web_app, context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
601 602 603 |
# File 'lib/trinidad/web_app.rb', line 601 def context @context end |
#monitor_mtime ⇒ Object
Returns the value of attribute monitor_mtime.
605 606 607 |
# File 'lib/trinidad/web_app.rb', line 605 def monitor_mtime @monitor_mtime end |
#web_app ⇒ Object (readonly)
Returns the value of attribute web_app.
600 601 602 |
# File 'lib/trinidad/web_app.rb', line 600 def web_app @web_app end |
Instance Method Details
#[](key) ⇒ Object
#deprecated behaves Hash like for (<= 1.3.5) compatibility
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
# File 'lib/trinidad/web_app.rb', line 616 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
633 634 635 636 637 638 639 640 641 642 643 |
# File 'lib/trinidad/web_app.rb', line 633 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
612 |
# File 'lib/trinidad/web_app.rb', line 612 def lock; @lock = true; end |
#locked? ⇒ Boolean
611 |
# File 'lib/trinidad/web_app.rb', line 611 def locked?; !!@lock; end |
#monitor ⇒ Object
603 |
# File 'lib/trinidad/web_app.rb', line 603 def monitor; web_app.monitor; end |
#try_lock ⇒ Object
607 608 609 |
# File 'lib/trinidad/web_app.rb', line 607 def try_lock locked? ? false : lock end |
#unlock ⇒ Object
613 |
# File 'lib/trinidad/web_app.rb', line 613 def unlock; @lock = false; end |