Class: DParse::Parsers::Opt

Inherits:
DParse::Parser show all
Defined in:
lib/d-parse/parsers/highlevel/opt.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DParse::Parser

#apply, #bind, #capture, #compact, #expectation_message, #first, #flatten, #ignore, #inspect, #map, #match?, #read, #second, #select_even, #select_odd, #to_s

Constructor Details

#initializeOpt

Returns a new instance of Opt.

Raises:

  • (ArgumentError)


11
12
13
# File 'lib/d-parse/parsers/highlevel/opt.rb', line 11

def initialize(*)
  raise ArgumentError, "#{self.class} is not supposed to be initialized"
end

Class Method Details

.new(parser) ⇒ Object



4
5
6
7
8
9
# File 'lib/d-parse/parsers/highlevel/opt.rb', line 4

def self.new(parser)
  DParse::Parsers::Alt.new(
    parser,
    DParse::Parsers::Succeed.new,
  )
end