Class: Freee::Response::Base
- Inherits:
-
Object
- Object
- Freee::Response::Base
- Defined in:
- lib/freee/obj/response.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#val ⇒ Object
readonly
Returns the value of attribute val.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #has_key?(name) ⇒ Boolean (also: #key, #include?, #member?)
-
#initialize(val) ⇒ Base
constructor
A new instance of Base.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(val) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/freee/obj/response.rb', line 7 def initialize(val) @val = Hash.try_convert(val) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
11 12 13 |
# File 'lib/freee/obj/response.rb', line 11 def method_missing(name, *args) @val[name.to_s] end |
Instance Attribute Details
#val ⇒ Object (readonly)
Returns the value of attribute val.
5 6 7 |
# File 'lib/freee/obj/response.rb', line 5 def val @val end |
Instance Method Details
#[](name) ⇒ Object
15 16 17 |
# File 'lib/freee/obj/response.rb', line 15 def [](name) @val[name.to_s] end |
#has_key?(name) ⇒ Boolean Also known as: key, include?, member?
19 20 21 22 23 24 25 |
# File 'lib/freee/obj/response.rb', line 19 def has_key?(name) if @val[name.to_s] return true else return false end end |