Module: Roglew::BaseContextModule

Defined in:
lib/roglew/contexts/base.rb

Overview

classes/modules that include BaseContextModule must implement methods #bind and #unbind

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objObject (readonly)

Returns the value of attribute obj.



23
24
25
# File 'lib/roglew/contexts/base.rb', line 23

def obj
  @obj
end

Class Method Details

.included(c) ⇒ Object



39
40
41
# File 'lib/roglew/contexts/base.rb', line 39

def self.included(c)
  c.extend ClassMethods
end

Instance Method Details

#handleObject



43
44
45
# File 'lib/roglew/contexts/base.rb', line 43

def handle
  @obj.handle
end

#initialize(obj, deferred, &block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/roglew/contexts/base.rb', line 25

def initialize(obj, deferred, &block)
  @obj, deferred = obj, obj.is_deferred?(deferred)
  c = singleton_class
  c.send(:include, deferred ? DeferredContext : ImmediateContext)
  mod = c.instance_variable_get(deferred ? :@deferred_mod : :@immediate_mod)
  c.send(:include, mod) if mod

  #handle.loaded_extensions.each do |ext|
  #  #TODO ???
  #end

  run(&block) if respond_to?(:run, true)
end