Class: Observed::Singleton

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/observed.rb

Instance Method Summary collapse

Instance Method Details

#configure(*args) ⇒ Object



45
46
47
# File 'lib/observed.rb', line 45

def configure(*args)
  @context.configure *args
end

#init!Object

Call this method before you are going to build 2nd or later Observed configuration using this module. Refrain that Observed object is a builder for Observed configuration and it has global state. We have to reset its state via this init! method before building next configurations after the first one.



34
35
36
37
# File 'lib/observed.rb', line 34

def init!
  @context = Observed::Context.new
  @observed = @context.config_dsl
end

#run(tag = nil, data = nil, options = nil) ⇒ Object



39
40
41
42
43
# File 'lib/observed.rb', line 39

def run(tag=nil, data=nil, options=nil)
  sys = @context.system
  sys.config = @observed.config
  sys.send :run, *[tag, data, options].take_while { |a| a != nil }
end