This commit is contained in:
Akira Matsuda 2017-10-13 15:48:02 +09:00
parent f26e0357e3
commit ef0c2c1af6
1 changed files with 2 additions and 2 deletions

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 }