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.



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

#contextObject

Returns the value of attribute context.



240
241
242
# File 'lib/trinidad/web_app.rb', line 240

def context
  @context
end

#monitor_mtimeObject

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

#lockObject



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

def lock; @lock = true; end

#locked?Boolean

Returns:

  • (Boolean)


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

def locked?; !!@lock; end

#monitorObject



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

def monitor; web_app.monitor; end

#try_lockObject



246
247
248
# File 'lib/trinidad/web_app.rb', line 246

def try_lock
  locked? ? false : lock
end

#unlockObject



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

def unlock; @lock = false; end