Module: Threatinator::PropertyDefiner::ClassMethods

Defined in:
lib/threatinator/property_definer.rb

Instance Method Summary collapse

Instance Method Details

#_define_property(prop) ⇒ Object



85
86
87
88
89
90
91
92
93
94
# File 'lib/threatinator/property_definer.rb', line 85

def _define_property(prop)
  name = prop.name
  _properties[name] = prop
  define_method("#{prop.name}=".to_sym) do |newval|
    _set(name, newval)
  end
  define_method(name) do 
    _get(name)
  end
end

#_propertiesObject



81
82
83
# File 'lib/threatinator/property_definer.rb', line 81

def _properties
  @@properties ||= {}
end

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



96
97
98
# File 'lib/threatinator/property_definer.rb', line 96

def property(name, opts = {})
  _define_property(Property.new(name, opts))
end