Class: Deserializer::Attribute::Base

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

Direct Known Subclasses

Association, ValueAttribute

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, opts = {}, object) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
# File 'lib/deserializer/attribute/base.rb', line 7

def initialize( name, opts = {}, object )
  self.name   = name
  self.opts   = opts
  self.object = object
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/deserializer/attribute/base.rb', line 5

def name
  @name
end

Instance Method Details

#to_hash(params) ⇒ Object

has_one :whatever; where def wahtever{ object } { object }



21
22
23
24
# File 'lib/deserializer/attribute/base.rb', line 21

def to_hash( params )
  return {} unless params.has_key? key
  tuple( params )
end