Sha256: 612afc4dca3469c4ce735d09fcf82ea9964890b09cebd7d724de23b1c4a54e77
Contents?: true
Size: 888 Bytes
Versions: 3
Compression:
Stored size: 888 Bytes
Contents
module Sexpr module Node EMPTY_TRACKING_MARKERS = {} def tracking_markers @tracking_markers ||= EMPTY_TRACKING_MARKERS end def tracking_markers=(markers) @tracking_markers = markers end def sexpr_type first end alias :sexp_type :sexpr_type def sexpr_body self[1..-1] end alias :sexp_body :sexpr_body def sexpr_copy(&block) if block copy = sexpr_copy_tagging([ sexpr_type ]) sexpr_body.inject(copy, &block) else sexpr_copy_tagging(self[0..-1]) end end alias :dup :sexpr_copy private def sexpr_copy_tagging(copy) (class << self; self; end).included_modules.each do |mod| copy.extend(mod) unless mod === copy end copy.tracking_markers = tracking_markers copy end end # module Node include Node end # module Sexpr
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sexpr-1.1.0 | lib/sexpr/node.rb |
sexpr-1.0.0 | lib/sexpr/node.rb |
sexpr-0.6.0 | lib/sexpr/node.rb |