Sha256: 2e980c71e6d9c4611068272ebe346c9320128823b27e2048de8c394763b726da

Contents?: true

Size: 921 Bytes

Versions: 8

Compression:

Stored size: 921 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__ method }
          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

8 entries across 8 versions & 1 rubygems

Version Path
pragmater-9.3.0 lib/pragmater/cli/options/insert_remove.rb
pragmater-9.2.0 lib/pragmater/cli/options/insert_remove.rb
pragmater-9.1.2 lib/pragmater/cli/options/insert_remove.rb
pragmater-9.1.1 lib/pragmater/cli/options/insert_remove.rb
pragmater-9.1.0 lib/pragmater/cli/options/insert_remove.rb
pragmater-9.0.0 lib/pragmater/cli/options/insert_remove.rb
pragmater-8.3.0 lib/pragmater/cli/options/insert_remove.rb
pragmater-8.2.0 lib/pragmater/cli/options/insert_remove.rb