Skip to content

Commit

Permalink
handle boolean arguments correctly in splat attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Mar 21, 2012
1 parent 564c255 commit 1c41791
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions lib/slim/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,22 @@ def on_slim_attr(name, escape, code)
def on_slim_splat(code)
name, value = unique_name, unique_name
[:block, "(#{code}).each do |#{name},#{value}|",
[:multi,
[:static, ' '],
[:escape, true, [:dynamic, name]],
[:static, "=#{options[:attr_wrapper]}"],
[:escape, true, [:dynamic, value]],
[:static, options[:attr_wrapper]]
]]
[:case, value,
['true',
[:multi,
[:static, ' '],
[:dynamic, name],
[:static, "=#{options[:attr_wrapper]}"],
[:dynamic, name],
[:static, options[:attr_wrapper]]]],
['false, nil', [:multi]],
[:else,
[:multi,
[:static, ' '],
[:dynamic, name],
[:static, "=#{options[:attr_wrapper]}"],
[:escape, true, [:dynamic, value]],
[:static, options[:attr_wrapper]]]]]]
end
end
end

0 comments on commit 1c41791

Please sign in to comment.