Permalink
Browse files

+ Gave Sexp#structure a ~10% boost

[git-p4: depot-paths = "//src/sexp_processor/dev/": change = 8062]
  • Loading branch information...
1 parent cd3f26e commit 41464e34367bf7b2895053b1ac97d275ee1c87a8 @zenspider zenspider committed Dec 17, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/sexp.rb
View
@@ -247,16 +247,15 @@ def shift
# s(:a, :b, s(:c, :d), :e) => s(:a, s(:c))
def structure
- result = self.class.new
if Array === self.first then
- result = s(:bogus, *self).structure # TODO: remove >= 4.2.0
+ s(:bogus, *self).structure # TODO: remove >= 4.2.0
else
- result << self.first
- self.grep(Sexp).each do |subexp|
- result << subexp.structure
+ result = s(self.first)
+ self.each do |subexp|
+ result << subexp.structure if Sexp === subexp
end
+ result
end
- result
end
##

0 comments on commit 41464e3

Please sign in to comment.