class XMLScan::Input

Attributes

src[R]

Public Class Methods

gets() click to toggle source
   # File lib/xmlscan/scanner.rb
52 def self.gets ; @v.at(@n += 1) ; end
lineno() click to toggle source
   # File lib/xmlscan/scanner.rb
53 def self.lineno ; @n + 1 ; end
new(src) click to toggle source
   # File lib/xmlscan/scanner.rb
46 def initialize(src)
47   @src = src
48   unless src.respond_to? :gets then
49     if src.respond_to? :to_ary then
50       @v = src.to_ary
51       @n = -1
52       def self.gets ; @v.at(@n += 1) ; end
53       def self.lineno ; @n + 1 ; end
54     else
55       @v = @src
56       def self.gets ; s = @v ; @v = nil ; s ; end
57     end
58   end
59   if src.respond_to? :lineno then
60     def self.lineno ; @src.lineno ; end
61   end
62   if src.respond_to? :path then
63     def self.path ; @src.path ; end
64   end
65 end
path() click to toggle source
   # File lib/xmlscan/scanner.rb
63 def self.path ; @src.path ; end
unwrap(obj) click to toggle source
   # File lib/xmlscan/scanner.rb
81 def self.unwrap(obj)
82   if self === obj then
83     obj.src
84   else
85     obj
86   end
87 end
wrap(src) click to toggle source
   # File lib/xmlscan/scanner.rb
73 def self.wrap(src)
74   unless src.respond_to? :gets and src.respond_to? :lineno and
75       src.respond_to? :path then
76     src = new(src)
77   end
78   src
79 end

Public Instance Methods

gets() click to toggle source
   # File lib/xmlscan/scanner.rb
69 def gets ; @src.gets ; end
lineno() click to toggle source
   # File lib/xmlscan/scanner.rb
70 def lineno ; 0 ; end
path() click to toggle source
   # File lib/xmlscan/scanner.rb
71 def path ; '-' ; end