Class: Fathom::Agent

Inherits:
Object
  • Object
show all
Includes:
Properties
Defined in:
lib/fathom/agent.rb

Instance Method Summary collapse

Methods included from Properties

included

Constructor Details

#initialize(opts = {}) ⇒ Agent

Returns a new instance of Agent.



10
11
12
13
# File 'lib/fathom/agent.rb', line 10

def initialize(opts={})
  self.class.define_property_states
  assert_node_accessors(opts)
end

Instance Method Details

#callbacksObject



22
23
24
# File 'lib/fathom/agent.rb', line 22

def callbacks
  @callbacks ||= (self.methods - Object.methods).grep(/^on_(\w+)/)
end

#statesObject



15
16
17
18
19
20
# File 'lib/fathom/agent.rb', line 15

def states
  @states ||= self.class.properties.inject({}) do |h, state_method_name|
    h[state_method_name] = nil
    h
  end
end