Class: Heroku::Client::HerokuObj
- Inherits:
-
Object
- Object
- Heroku::Client::HerokuObj
- Defined in:
- lib/heroku-client/heroku_obj.rb
Instance Method Summary collapse
-
#initialize(json) ⇒ HerokuObj
constructor
A new instance of HerokuObj.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(json) ⇒ HerokuObj
Returns a new instance of HerokuObj.
19 20 21 |
# File 'lib/heroku-client/heroku_obj.rb', line 19 def initialize(json) @json = json end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/heroku-client/heroku_obj.rb', line 5 def method_missing(method, *args) attribute = method.to_s attribute = attribute.to_s[0..-2] if attribute.end_with?('?') super.method_missing(method, args) unless @json.has_key?(attribute) attr_value = @json["#{attribute}"] attr_value = HerokuObj.new(attr_value) if attr_value.is_a? Hash attr_value end |