lib/sexp.rb in sexp_processor-4.12.0 vs lib/sexp.rb in sexp_processor-4.12.1

- old
+ new

@@ -200,16 +200,19 @@ def find_nodes name each_sexp.find_all { |sexp| sexp.sexp_type == name } end + UNASSIGNED = Object.new + ## # If passed a line number, sets the line and returns self. Otherwise # returns the line number. This allows you to do message cascades # and still get the sexp back. - def line n = nil - if n then + def line n = UNASSIGNED + if n != UNASSIGNED then + raise ArgumentError, "setting %p.line %p" % [self, n] unless Integer === n @line = n self else @line ||= nil end