Class: Frulo::Resource
- Inherits:
-
Object
- Object
- Frulo::Resource
- Defined in:
- lib/frulo.rb
Direct Known Subclasses
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(data) ⇒ Resource
constructor
A new instance of Resource.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(data) ⇒ Resource
Returns a new instance of Resource.
31 32 33 |
# File 'lib/frulo.rb', line 31 def initialize(data) @data = data end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/frulo.rb', line 39 def method_missing(method, *args, &block) if method.to_s =~ /\?$/ send(method.to_s[0..-2]) elsif @data.include?(method.to_s) @data[method.to_s] else super end end |
Instance Method Details
#id ⇒ Object
35 36 37 |
# File 'lib/frulo.rb', line 35 def id @data["id"] end |