Skip to content

Commit

Permalink
Merge branch 'hotfix-0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgoetze committed Sep 22, 2015
2 parents 3a00d25 + 206c88b commit 0ffd091
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
5 changes: 1 addition & 4 deletions lib/code_breaker/parsable/data_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,11 @@ def parse_int_node(node)
node.children[0].class
end

def parse_hash_node(node)
{ node.type => parse_children(node).inject(:merge).to_h }
end

def parse_pair_node(node)
{ parse(node.children[0]) => parse(node.children[1]) }
end

alias :parse_hash_node :parse_as_hash
alias :parse_array_node :parse_as_hash
end
end
Expand Down
14 changes: 6 additions & 8 deletions lib/code_breaker/parsable/keywords.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ module Keywords
alias :parse_or_node :parse_as_hash
alias :parse_and_node :parse_as_hash
alias :parse_def_node :parse_as_hash
alias :parse_module_node :parse_as_hash
alias :parse_yield_node :parse_as_hash

alias :parse_break_node :parse_as_node_type
alias :parse_next_node :parse_as_node_type
alias :parse_retry_node :parse_as_node_type
alias :parse_self_node :parse_as_node_type
alias :parse_rescue_node :parse_as_hash
alias :parse_resbody_node :parse_as_hash
alias :parse_case_node :parse_as_hash
alias :parse_resbody_node :parse_as_hash

alias :parse_break_node :parse_as_node_type
alias :parse_next_node :parse_as_node_type
alias :parse_retry_node :parse_as_node_type
alias :parse_self_node :parse_as_node_type

def parse_loop_node(node)
condition = node.children[0]
Expand Down
2 changes: 1 addition & 1 deletion lib/code_breaker/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CodeBreaker
VERSION = "0.1.0"
VERSION = "0.1.1"
end
8 changes: 7 additions & 1 deletion spec/code_breaker/parser/data_types_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
context 'for a root node representing a Hash' do
it 'returns a Hash with key :hash and a Hash of key/type pairs' do
input = "{ euro: '€', 'dollar' => 1.1521 }"
output = { hash: { Symbol => String, String => Float } }
output = { hash: [{ Symbol => String }, { String => Float }] }
expect(input).to be_parsed_as output
end

it 'returns a Hash with key :hash and a Hash of key/type pairs' do
input = "{ euro: '€', dollar: 1.1521 }"
output = { hash: [{ Symbol => String }, { Symbol => Float }] }
expect(input).to be_parsed_as output
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/code_breaker/parser/language_elements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
{
args: [
{ arg: :name},
{ optarg: [:options, { hash: { Symbol => Fixnum } }] }
{ optarg: [:options, { hash: [{ Symbol => Fixnum }] }] }
]
},
String
Expand Down

0 comments on commit 0ffd091

Please sign in to comment.