Module: Fathom::Properties::ClassMethods

Defined in:
lib/fathom/agent/properties.rb

Instance Method Summary collapse

Instance Method Details

#define_property_statesObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fathom/agent/properties.rb', line 19

def define_property_states
  return true if @property_states_defined
  self.properties.each do |state_method_name|
    unless self.instance_methods.include?(state_method_name.to_s)
      define_method(state_method_name) do
        states[state_method_name]
      end
    end
    
    state_method_writer = "#{state_method_name}=".to_sym
    unless self.instance_methods.include?(state_method_writer.to_s)
      define_method(state_method_writer) do |value|
        states[state_method_name] = value
      end
    end
  end
  
  @property_states_defined = true
end

#propertiesObject



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

def properties
  @properties ||= []
end

#property(name, opts = {}) ⇒ Object



15
16
17
# File 'lib/fathom/agent/properties.rb', line 15

def property(name, opts={})
  self.properties << name_sym(name)
end