Class: Trinidad::WebApp::Holder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contextObject

Returns the value of attribute context.



601
602
603
# File 'lib/trinidad/web_app.rb', line 601

def context
  @context
end

#monitor_mtimeObject

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_appObject (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

#lockObject



612
# File 'lib/trinidad/web_app.rb', line 612

def lock; @lock = true; end

#locked?Boolean

Returns:

  • (Boolean)


611
# File 'lib/trinidad/web_app.rb', line 611

def locked?; !!@lock; end

#monitorObject



603
# File 'lib/trinidad/web_app.rb', line 603

def monitor; web_app.monitor; end

#try_lockObject



607
608
609
# File 'lib/trinidad/web_app.rb', line 607

def try_lock
  locked? ? false : lock
end

#unlockObject



613
# File 'lib/trinidad/web_app.rb', line 613

def unlock; @lock = false; end