Class: Code42::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/code42/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Attribute

Returns a new instance of Attribute.



6
7
8
9
10
11
# File 'lib/code42/attribute.rb', line 6

def initialize(name, options = {})
  @name = name.to_sym
  @from = (options[:from] || name.to_s.camelize(:lower)).to_s
  @as   = options[:as]
  @collection = options[:collection]
end

Instance Attribute Details

#asObject (readonly)

Returns the value of attribute as.



3
4
5
# File 'lib/code42/attribute.rb', line 3

def as
  @as
end

#collectionObject (readonly)

Returns the value of attribute collection.



3
4
5
# File 'lib/code42/attribute.rb', line 3

def collection
  @collection
end

#fromObject (readonly)

Returns the value of attribute from.



3
4
5
# File 'lib/code42/attribute.rb', line 3

def from
  @from
end

#nameObject (readonly) Also known as: to

Returns the value of attribute name.



3
4
5
# File 'lib/code42/attribute.rb', line 3

def name
  @name
end