Class: Gobbler::Base
- Inherits:
-
Object
- Object
- Gobbler::Base
- Defined in:
- lib/gobbler/base.rb
Direct Known Subclasses
Checkpoint, ClientVersion, Dashboard, Folder, Machine, Project, Quota, Referral, Volume
Instance Attribute Summary collapse
-
#json ⇒ Object
Returns the value of attribute json.
Class Method Summary collapse
Instance Method Summary collapse
- #base_attr ⇒ Object
-
#initialize(json) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(json) ⇒ Base
Returns a new instance of Base.
9 10 11 |
# File 'lib/gobbler/base.rb', line 9 def initialize(json) @json = json end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gobbler/base.rb', line 17 def method_missing(method, *args, &block) if base_attr.keys.include?(method.to_s) || method == :assets if method == :assets && base_attr.keys.include?("assets_packed") ::Gobbler.unpack(base_attr["assets_packed"]) else base_attr[method.to_s] end else super(method, *args, &block) end end |
Instance Attribute Details
#json ⇒ Object
Returns the value of attribute json.
3 4 5 |
# File 'lib/gobbler/base.rb', line 3 def json @json end |
Class Method Details
.get(guid) ⇒ Object
5 6 7 |
# File 'lib/gobbler/base.rb', line 5 def self.get(guid) list.find {|p| p.guid == guid} end |
Instance Method Details
#base_attr ⇒ Object
13 |
# File 'lib/gobbler/base.rb', line 13 def base_attr; json; end |