Class: HParser::Util::Or
- Inherits:
-
Object
- Object
- HParser::Util::Or
- Defined in:
- lib/hparser/util/parser.rb
Instance Method Summary collapse
-
#initialize(*parsers) ⇒ Or
constructor
A new instance of Or.
- #parse(*args) ⇒ Object
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 |