Class: JSONY::Receiver
- Inherits:
-
Pegex::Tree
- Object
- Pegex::Tree
- JSONY::Receiver
- Defined in:
- lib/jsony/receiver.rb
Instance Method Summary collapse
- #got_bare(got) ⇒ Object
- #got_map(got) ⇒ Object
- #got_seq(got) ⇒ Object
- #got_string(got) ⇒ Object
- #got_top_map(got) ⇒ Object
- #got_top_seq_entry(got) ⇒ Object
Instance Method Details
#got_bare(got) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jsony/receiver.rb', line 24 def got case got when 'true' true when 'false' false when 'null' Pegex::Constant::Null when \ /^( -? (?: 0 | [1-9] [0-9]* ) (?: \. [0-9]* )? (?: [eE] [\-\+]? [0-9]+ )? )$/x got.to_i else got.to_s end end |
#got_map(got) ⇒ Object
16 17 18 |
# File 'lib/jsony/receiver.rb', line 16 def got_map got Hash[got[0]] end |
#got_seq(got) ⇒ Object
12 13 14 |
# File 'lib/jsony/receiver.rb', line 12 def got_seq got got[0] end |
#got_string(got) ⇒ Object
20 21 22 |
# File 'lib/jsony/receiver.rb', line 20 def got_string got got.to_s end |
#got_top_map(got) ⇒ Object
8 9 10 |
# File 'lib/jsony/receiver.rb', line 8 def got_top_map got got_map [got] end |
#got_top_seq_entry(got) ⇒ Object
4 5 6 |
# File 'lib/jsony/receiver.rb', line 4 def got_top_seq_entry got got[0][0] end |