Class: Wreckster::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/wreckster/object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(traversal, properties) ⇒ Object

Returns a new instance of Object.



5
6
7
8
9
10
11
# File 'lib/wreckster/object.rb', line 5

def initialize traversal, properties
  @traversal  = traversal
  @properties = properties
  @identifier = properties['_id']
  @rank       = properties[traversal]
  @type       = properties['type']
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(key, *args) ⇒ Object



17
18
19
20
# File 'lib/wreckster/object.rb', line 17

def method_missing key, *args
  return super unless respond_to? key
  @properties[key.to_s]
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



3
4
5
# File 'lib/wreckster/object.rb', line 3

def identifier
  @identifier
end

#rankObject (readonly)

Returns the value of attribute rank.



3
4
5
# File 'lib/wreckster/object.rb', line 3

def rank
  @rank
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/wreckster/object.rb', line 3

def type
  @type
end

Instance Method Details

#respond_to?(key) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/wreckster/object.rb', line 13

def respond_to? key
  @properties.key?(key.to_s) || super
end