Class: Asciidoctor::Server::Cli::Options

Inherits:
Struct
  • Object
show all
Defined in:
lib/asciidoctor-server/cli.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#addressObject

Returns the value of attribute address



9
10
11
# File 'lib/asciidoctor-server/cli.rb', line 9

def address
  @address
end

#thread_pool_sizeObject

Returns the value of attribute thread_pool_size



9
10
11
# File 'lib/asciidoctor-server/cli.rb', line 9

def thread_pool_size
  @thread_pool_size
end

Class Method Details

.parse(args) ⇒ Object



10
11
12
13
14
15
# File 'lib/asciidoctor-server/cli.rb', line 10

def self.parse(args)
  Options.new(
    ::GRPC::RpcServer::DEFAULT_POOL_SIZE,
    "unix://#{Pathname.pwd / ".asciidoctor-server.sock"}"
  ).parse(args)
end

Instance Method Details

#parse(args) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/asciidoctor-server/cli.rb', line 17

def parse(args)
  positional_args = OptionParser.new do |parser|
    parser.on("-addr ADDRESS", "--address ADDRESS")
    parser.on("-t THREAD_POOL_SIZE", "--thread_pool_size", Integer, "thread pool size")
    parser.on("-h", "--help", "print help") do
      puts parser
      exit
    end
  end.parse(args, into: self)
  self
end