1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
This commit is contained in:
Akira Matsuda 2017-10-13 15:48:02 +09:00
parent f26e0357e3
commit ef0c2c1af6

View file

@ -98,7 +98,7 @@ module Haml
all_tokens = Ripper.lex(hash_literal.strip) all_tokens = Ripper.lex(hash_literal.strip)
all_tokens = all_tokens[1...-1] || [] # strip tokens for brackets all_tokens = all_tokens[1...-1] || [] # strip tokens for brackets
each_balaned_tokens(all_tokens) do |tokens| each_balanced_tokens(all_tokens) do |tokens|
key = shift_key!(tokens) key = shift_key!(tokens)
value = tokens.map {|t| t[2] }.join.strip value = tokens.map {|t| t[2] }.join.strip
block.call(key, value) block.call(key, value)
@ -107,7 +107,7 @@ module Haml
# @param [Array] tokens - Ripper tokens # @param [Array] tokens - Ripper tokens
# @param [Proc] block - that takes balanced Ripper tokens as arguments # @param [Proc] block - that takes balanced Ripper tokens as arguments
def each_balaned_tokens(tokens, &block) def each_balanced_tokens(tokens, &block)
attr_tokens = [] attr_tokens = []
open_tokens = Hash.new { |h, k| h[k] = 0 } open_tokens = Hash.new { |h, k| h[k] = 0 }