Skip to content

Commit

Permalink
Merge f2c5dbb into 0c95f63
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Jan 17, 2021
2 parents 0c95f63 + f2c5dbb commit da7d43b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/synvert/core/engine/erb.rb
Expand Up @@ -111,9 +111,10 @@ def add_expr_escaped(src, code)
def add_stmt(src, code)
flush_newline_if_pending(src)
if code != "\n" && code != ""
index = if code =~ /\A(\s*)\r?\n/
index = case code
when /\A(\s*)\r?\n/
$1.length
elsif code =~ /\A(\s+)/
when /\A(\s+)/
$1.end_with?(' ') ? $1.length - 1 : $1.length
else
0
Expand Down
5 changes: 3 additions & 2 deletions lib/synvert/core/node_ext.rb
Expand Up @@ -337,11 +337,12 @@ def recursive_children
# @return true if matches.
def match?(rules)
flat_hash(rules).keys.all? do |multi_keys|
if multi_keys.last == :any
case multi_keys.last
when :any
actual_values = actual_value(self, multi_keys[0...-1])
expected = expected_value(rules, multi_keys)
actual_values.any? { |actual| match_value?(actual, expected) }
elsif multi_keys.last == :not
when :not
actual = actual_value(self, multi_keys[0...-1])
expected = expected_value(rules, multi_keys)
!match_value?(actual, expected)
Expand Down

0 comments on commit da7d43b

Please sign in to comment.