Module: LogicalModel::Attributes::ClassMethods

Defined in:
lib/logical_model/attributes.rb

Instance Method Summary collapse

Instance Method Details

#attribute(name) ⇒ Object

declares an attribute.

Examples:

class Client < LogicalModel
  attribute :att_name
end

Parameters:

  • name (Symbol)


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

def attribute(name)
  @attribute_keys = [] if @attribute_keys.nil?
  @attribute_keys << name
  attr_accessor name
end

#attribute_keysObject



52
53
54
# File 'lib/logical_model/attributes.rb', line 52

def attribute_keys
  @attribute_keys
end

#attribute_keys=(keys) ⇒ Object

overrides attributes with given keys.

Parameters:

  • keys (Array<Symbol>)


47
48
49
50
# File 'lib/logical_model/attributes.rb', line 47

def attribute_keys=(keys)
  @attribute_keys = keys
  attr_accessor *keys
end