Sha256: fe3de9a42dbcad08cb3bffa3c2dc43e39d1bb2c555700914622d1707b0e3266b

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

module Pragmater
  module CLI
    module Options
      # Defines gem configuration options.
      class Configuration
        def initialize values, parser: OptionParser.new
          @parser = parser
          @values = values
        end

        def call
          parser.separator "\nConfiguration:\n"
          private_methods.grep(/add_/).each(&method(:__send__))
          parser
        end

        private

        attr_reader :parser, :values

        def add_edit
          parser.on "--edit", "Edit configuration." do
            values[:edit] = true
          end
        end

        def add_info
          parser.on "--info", "Print configuration." do
            values[:info] = true
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pragmater-8.1.0 lib/pragmater/cli/options/configuration.rb
pragmater-8.0.0 lib/pragmater/cli/options/configuration.rb