File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,14 +45,11 @@ def parse_int_node(node)
4545 node . children [ 0 ] . class
4646 end
4747
48- def parse_hash_node ( node )
49- { node . type => parse_children ( node ) . inject ( :merge ) . to_h }
50- end
51-
5248 def parse_pair_node ( node )
5349 { parse ( node . children [ 0 ] ) => parse ( node . children [ 1 ] ) }
5450 end
5551
52+ alias :parse_hash_node :parse_as_hash
5653 alias :parse_array_node :parse_as_hash
5754 end
5855 end
Original file line number Diff line number Diff line change @@ -11,16 +11,14 @@ module Keywords
1111 alias :parse_or_node :parse_as_hash
1212 alias :parse_and_node :parse_as_hash
1313 alias :parse_def_node :parse_as_hash
14- alias :parse_module_node :parse_as_hash
1514 alias :parse_yield_node :parse_as_hash
16-
17- alias :parse_break_node :parse_as_node_type
18- alias :parse_next_node :parse_as_node_type
19- alias :parse_retry_node :parse_as_node_type
20- alias :parse_self_node :parse_as_node_type
2115 alias :parse_rescue_node :parse_as_hash
22- alias :parse_resbody_node :parse_as_hash
23- alias :parse_case_node :parse_as_hash
16+ alias :parse_resbody_node :parse_as_hash
17+
18+ alias :parse_break_node :parse_as_node_type
19+ alias :parse_next_node :parse_as_node_type
20+ alias :parse_retry_node :parse_as_node_type
21+ alias :parse_self_node :parse_as_node_type
2422
2523 def parse_loop_node ( node )
2624 condition = node . children [ 0 ]
Original file line number Diff line number Diff line change 11module CodeBreaker
2- VERSION = "0.1.0 "
2+ VERSION = "0.1.1 "
33end
Original file line number Diff line number Diff line change 3232 context 'for a root node representing a Hash' do
3333 it 'returns a Hash with key :hash and a Hash of key/type pairs' do
3434 input = "{ euro: '€', 'dollar' => 1.1521 }"
35- output = { hash : { Symbol => String , String => Float } }
35+ output = { hash : [ { Symbol => String } , { String => Float } ] }
36+ expect ( input ) . to be_parsed_as output
37+ end
38+
39+ it 'returns a Hash with key :hash and a Hash of key/type pairs' do
40+ input = "{ euro: '€', dollar: 1.1521 }"
41+ output = { hash : [ { Symbol => String } , { Symbol => Float } ] }
3642 expect ( input ) . to be_parsed_as output
3743 end
3844 end
Original file line number Diff line number Diff line change 8080 {
8181 args : [
8282 { arg : :name } ,
83- { optarg : [ :options , { hash : { Symbol => Fixnum } } ] }
83+ { optarg : [ :options , { hash : [ { Symbol => Fixnum } ] } ] }
8484 ]
8585 } ,
8686 String
You can’t perform that action at this time.
0 commit comments