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.



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

#contextObject

Returns the value of attribute context.



521
522
523
# File 'lib/trinidad/web_app.rb', line 521

def context
  @context
end

#monitor_mtimeObject

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

#lockObject



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

def lock; @lock = true; end

#locked?Boolean

Returns:

  • (Boolean)


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

def locked?; !!@lock; end

#monitorObject



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

def monitor; web_app.monitor; end

#try_lockObject



527
528
529
# File 'lib/trinidad/web_app.rb', line 527

def try_lock
  locked? ? false : lock
end

#unlockObject



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

def unlock; @lock = false; end