Class: Reader::JSTP::Dispatch
- Inherits:
-
Discoverer::Pattern
- Object
- Discoverer::Pattern
- Reader::JSTP::Dispatch
- Defined in:
- lib/reader/jstp/dispatch.rb
Instance Method Summary collapse
- #array(the_array) ⇒ Object
- #hash(the_hash) ⇒ Object
-
#string(the_string) ⇒ Object
Actually, is JSON.
Instance Method Details
#array(the_array) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/reader/jstp/dispatch.rb', line 22 def array the_array @source.method = the_array.first if the_array.first @source.resource = the_array[1] if the_array[1] @source.body = the_array[2] if the_array[2] if the_array[3] the_array[3].each do |key, value| @source[key] = value end end @source end |
#hash(the_hash) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/reader/jstp/dispatch.rb', line 5 def hash the_hash the_hash.each do |key, value| @source[key] = value end @source end |
#string(the_string) ⇒ Object
Actually, is JSON
14 15 16 17 18 19 20 |
# File 'lib/reader/jstp/dispatch.rb', line 14 def string the_string JSON.load(the_string).each do |key, value| @source[key] = value end @source end |