Class: TracksAttributes::AttrInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/tracks_attributes/attr_info.rb

Overview

Holds the information needed by a class including TracksAttributes in order to track information that can be effectively used to re-hydrate instances from JSON or XML

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(props = {}) ⇒ AttrInfo

Props

* :name - the attribute name
* :kass - the attribute class
* :is_readable - true if the attribute is readable
* :is_writeable - true if the attribute is writeable


16
17
18
19
20
21
# File 'lib/tracks_attributes/attr_info.rb', line 16

def initialize(props = {})
  self.name   = props[:name]
  self.klass  = props[:klass]
  self.is_readable   = props[:is_readable] || true
  self.is_writeable  = props[:is_writeable] || true
end

Instance Attribute Details

#is_readableObject

Returns the value of attribute is_readable.



7
8
9
# File 'lib/tracks_attributes/attr_info.rb', line 7

def is_readable
  @is_readable
end

#is_writeableObject

Returns the value of attribute is_writeable.



7
8
9
# File 'lib/tracks_attributes/attr_info.rb', line 7

def is_writeable
  @is_writeable
end

#klassObject

Returns the value of attribute klass.



7
8
9
# File 'lib/tracks_attributes/attr_info.rb', line 7

def klass
  @klass
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/tracks_attributes/attr_info.rb', line 7

def name
  @name
end