Class: Openlayer::Object

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

Direct Known Subclasses

Project, ProjectVersion

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Object

Returns a new instance of Object.



6
7
8
# File 'lib/openlayer/object.rb', line 6

def initialize(attributes)
  @attributes = OpenStruct.new(attributes)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



10
11
12
13
14
# File 'lib/openlayer/object.rb', line 10

def method_missing(method, *args, &block)
  method = snake_to_camel(method.to_s)
  attribute = @attributes.send(method, *args, &block)
  attribute.is_a?(Hash) ? Object.new(attribute) : attribute
end

Instance Method Details

#respond_to_missing?(_method, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/openlayer/object.rb', line 16

def respond_to_missing?(_method, _include_private = false)
  true
end