class Lino::SubcommandBuilder
Public Class Methods
for_subcommand(subcommand)
click to toggle source
# File lib/lino/subcommand_builder.rb, line 15 def for_subcommand(subcommand) SubcommandBuilder.new(subcommand: subcommand) end
new(subcommand: nil, options: [])
click to toggle source
# File lib/lino/subcommand_builder.rb, line 20 def initialize(subcommand: nil, options: []) @subcommand = subcommand @options = Hamster::Vector.new(options) end
Public Instance Methods
build(option_separator, option_quoting)
click to toggle source
# File lib/lino/subcommand_builder.rb, line 25 def build(option_separator, option_quoting) components = [ @subcommand, map_and_join( @options, &(quote_with(option_quoting) >> join_with(option_separator)) ) ] components.reject(&:empty?).join(' ') end
Private Instance Methods
state()
click to toggle source
# File lib/lino/subcommand_builder.rb, line 42 def state { subcommand: @subcommand, options: @options } end
with(**replacements)
click to toggle source
# File lib/lino/subcommand_builder.rb, line 38 def with(**replacements) SubcommandBuilder.new(**state.merge(replacements)) end