Class: PgEventstore::CLI::Parsers::BaseParser

Inherits:
Object
  • Object
show all
Defined in:
lib/pg_eventstore/cli/parsers/base_parser.rb

Direct Known Subclasses

DefaultParser, SubscriptionParser

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, options) ⇒ BaseParser

Returns a new instance of BaseParser.

Parameters:

  • args (Array<String>)
  • options (PgEventstore::CLI::ParserOptions::BaseOptions)


18
19
20
21
22
# File 'lib/pg_eventstore/cli/parsers/base_parser.rb', line 18

def initialize(args, options)
  @args = args
  @options = options
  @parser = ::OptionParser.new(self.class.banner)
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



14
15
16
# File 'lib/pg_eventstore/cli/parsers/base_parser.rb', line 14

def args
  @args
end

#optionsObject (readonly)

Returns the value of attribute options.



14
15
16
# File 'lib/pg_eventstore/cli/parsers/base_parser.rb', line 14

def options
  @options
end

Class Method Details

Returns:

  • (String)

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/pg_eventstore/cli/parsers/base_parser.rb', line 9

def banner
  raise NotImplementedError
end

Instance Method Details

#parseArray<Array<String>, PgEventstore::CLI::ParserOptions::BaseOptions>

Returns list of commands and parsed options.

Returns:

  • (Array<Array<String>, PgEventstore::CLI::ParserOptions::BaseOptions>)

    list of commands and parsed options



26
27
28
29
# File 'lib/pg_eventstore/cli/parsers/base_parser.rb', line 26

def parse
  @options.attach_parser_handlers(@parser)
  [@parser.parse(args), @options]
end