module Altria::Proprietary::ClassMethods

Public Instance Methods

properties() click to toggle source
# File lib/altria/proprietary.rb, line 35
def properties
  @properties ||= []
end
property(name, options = {}) click to toggle source
# File lib/altria/proprietary.rb, line 13
def property(name, options = {})
  property = Property.new(name, options)
  properties << property

  define_method(name) do
    properties[name.to_s]
  end

  define_method("#{name}=") do |value|
    properties[name.to_s] = begin
      case
      when property.type != :boolean
        value
      when value.to_s == "false"
        false
      else
        true
      end
    end
  end
end
property_names() click to toggle source
# File lib/altria/proprietary.rb, line 39
def property_names
  properties.map(&:name)
end