Skip to content

Commit

Permalink
fix handling of parameter names passed to merge-params; the keys are …
Browse files Browse the repository at this point in the history
…symbols, not strings
  • Loading branch information
al2o3cr committed Dec 27, 2011
1 parent eebefcd commit 66526f0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions dryml/features/merge_params.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Feature: merge-params

Scenario: merge-params with a param name
Given a file named "doctest_taglib.dryml" with:
"""
<def tag="myp">
<p param="foo">This is foo</p>
<p param="bar">This is bar</p>
</def>
"""
And a file named "doctest_extend.dryml" with:
"""
<extend tag="myp">
<old-myp merge-params="bar" />
</extend>
"""
And a file named "doctest.dryml" with:
"""
<myp>
<foo:>
New stuff
</foo:>
<bar:>
Brand-new bar
</bar:>
</myp>
"""
When I include the taglib "doctest_taglib"
And I include the taglib "doctest_extend"
When I render "doctest.dryml"
Then the output DOM should be:
"""
<p class="foo">This is foo</p>
<p class="bar">Brand-new bar</p>
"""

2 changes: 1 addition & 1 deletion dryml/lib/dryml/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def parameter_tags_hash(el, containing_tag_name=nil)
elsif is_code_attribute?(merge_params)
merge_params[1..-1]
else
merge_param_names = merge_params.split(/\s*,\s*/).*.gsub("-", "_")
merge_param_names = merge_params.split(/\s*,\s*/).*.gsub("-", "_").*.to_sym
"all_parameters & #{merge_param_names.inspect}"
end
"merge_parameter_hashes({#{param_items}}, (#{extra_params}) || {})"
Expand Down

0 comments on commit 66526f0

Please sign in to comment.