Class: HParser::Util::Or

Inherits:
Object
  • Object
show all
Defined in:
lib/hparser/util/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(*parsers) ⇒ Or

Returns a new instance of Or.



47
48
49
# File 'lib/hparser/util/parser.rb', line 47

def initialize(*parsers)
  @parsers = parsers
end

Instance Method Details

#parse(*args) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/hparser/util/parser.rb', line 51

def parse(*args)
  r = nil
  for parser in @parsers
    r = parser.parse(*args)
    if r then
      break
    end
  end
  r
end