Class: Mentawai::Core::Output
- Inherits:
-
Object
- Object
- Mentawai::Core::Output
- Defined in:
- lib/mentawai/core/output.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #get(key) ⇒ Object (also: #[])
- #hasKey?(key) ⇒ Boolean (also: #has_key?, #key?)
-
#initialize(res) ⇒ Output
constructor
A new instance of Output.
- #keys ⇒ Object
- #put(key, value) ⇒ Object (also: #[]=)
- #remove(key) ⇒ Object
- #values ⇒ Object (also: #each)
Constructor Details
#initialize(res) ⇒ Output
Returns a new instance of Output.
8 9 10 11 |
# File 'lib/mentawai/core/output.rb', line 8 def initialize(res) @response = res @values = Hash.new end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/mentawai/core/output.rb', line 6 def response @response end |
Instance Method Details
#get(key) ⇒ Object Also known as: []
13 14 15 |
# File 'lib/mentawai/core/output.rb', line 13 def get(key) @values[key] end |
#hasKey?(key) ⇒ Boolean Also known as: has_key?, key?
21 22 23 |
# File 'lib/mentawai/core/output.rb', line 21 def hasKey?(key) @values.has_key?(key) end |
#keys ⇒ Object
32 33 34 35 36 |
# File 'lib/mentawai/core/output.rb', line 32 def keys @values.each do |k,v| yield k end end |
#put(key, value) ⇒ Object Also known as: []=
17 18 19 |
# File 'lib/mentawai/core/output.rb', line 17 def put(key, value) @values[key] = value end |
#remove(key) ⇒ Object
28 29 30 |
# File 'lib/mentawai/core/output.rb', line 28 def remove(key) @values.delete(key) end |
#values ⇒ Object Also known as: each
38 39 40 41 42 |
# File 'lib/mentawai/core/output.rb', line 38 def values @values.each do |k,v| yield k,v end end |