Sha256: 97f9add4b3b0ab58d709de174868e7150b8c172502fdb263ad24695f78ca92e0

Contents?: true

Size: 912 Bytes

Versions: 2

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

module Pragmater
  module CLI
    module Options
      # Defines gem insert and remove options.
      class InsertRemove
        def initialize values, parser: OptionParser.new
          @values = values
          @parser = parser
        end

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

        private

        attr_reader :values, :parser

        def add_comments
          parser.on "--comments a,b,c", Array, "Add pragma comments." do |comments|
            values[:comments] = comments
          end
        end

        def add_includes
          parser.on "--includes a,b,c", Array, "Add console support." do |includes|
            values[:includes] = includes
          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/insert_remove.rb
pragmater-8.0.0 lib/pragmater/cli/options/insert_remove.rb