Sha256: 74b6cbe8243b544edaff4bbfece0165381f782c9e430066c3c82f61074049f44

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

module Lino
  module Builders
    module Mixins
      module OptionConfig
        def initialize(state)
          @option_separator = state[:option_separator] || ' '
          @option_quoting = state[:option_quoting]
          @option_placement = state[:option_placement] || :after_command
          super
        end

        def with_option_separator(option_separator)
          with(option_separator:)
        end

        def with_option_quoting(character)
          with(option_quoting: character)
        end

        def with_option_placement(option_placement)
          with(option_placement:)
        end

        def with_options_after_command
          with_option_placement(:after_command)
        end

        def with_options_after_subcommands
          with_option_placement(:after_subcommands)
        end

        def with_options_after_arguments
          with_option_placement(:after_arguments)
        end

        private

        def state
          super.merge(
            option_separator: @option_separator,
            option_quoting: @option_quoting,
            option_placement: @option_placement
          )
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lino-4.2.0.pre.2 lib/lino/builders/mixins/option_config.rb
lino-4.2.0.pre.1 lib/lino/builders/mixins/option_config.rb
lino-4.1.0 lib/lino/builders/mixins/option_config.rb
lino-4.1.0.pre.2 lib/lino/builders/mixins/option_config.rb
lino-4.1.0.pre.1 lib/lino/builders/mixins/option_config.rb
lino-4.0.0 lib/lino/builders/mixins/option_config.rb
lino-4.0.0.pre.2 lib/lino/builders/mixins/option_config.rb
lino-3.2.0.pre.10 lib/lino/builders/mixins/option_config.rb
lino-3.2.0.pre.9 lib/lino/builders/mixins/option_config.rb
lino-3.2.0.pre.8 lib/lino/builders/mixins/option_config.rb
lino-3.2.0.pre.7 lib/lino/builders/mixins/option_config.rb
lino-3.2.0.pre.6 lib/lino/builders/mixins/option_config.rb