Class: Locomotive::Coal::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/locomotive/coal/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Resource

Returns a new instance of Resource.



7
8
9
# File 'lib/locomotive/coal/resource.rb', line 7

def initialize(attributes)
  @attributes = attributes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/locomotive/coal/resource.rb', line 11

def method_missing(name, *args)
  if self.attributes.key?(name.to_s)
    self.attributes[name.to_s]
  else
    super
  end
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



5
6
7
# File 'lib/locomotive/coal/resource.rb', line 5

def attributes
  @attributes
end

Instance Method Details

#respond_to?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/locomotive/coal/resource.rb', line 19

def respond_to?(name, include_private = false)
  self.attributes.key?(name.to_s) || super
end