lib/ryan/condition.rb in ryan-1.1.0 vs lib/ryan/condition.rb in ryan-1.2.0
- old
+ new
@@ -57,12 +57,12 @@
# Private
#
def edit_return_text(txt)
txt = txt.to_s
- txt.sub! /^return\b/, 'returns'
- txt.sub! /^returns\s*$/, 'returns nil'
+ txt = txt.sub /^return\b/, 'returns'
+ txt = txt.sub /^returns\s*$/, 'returns nil'
if txt.include?(' = ')
txt = "assigns #{txt}"
elsif !txt.empty? and txt !~ /^return/
txt = "returns #{txt.strip}"
end
@@ -87,10 +87,12 @@
end
def create_nested_conditions
nc = Set.new
s = sexp.drop(1)
- s.flatten.include?(:if) && s.deep_each do |exp|
+ sexp = s
+ sexp = Sexp.new(s) unless s.respond_to?(:deep_each)
+ s.flatten.include?(:if) && sexp.deep_each do |exp|
Ryan::SexpDecorator.new(exp).each_sexp_condition do |node|
nc << self.class.new(node)
end
end
nc.to_a