Sha256: 254fc24410b8a47d2cfb713f1bcb4ac4fc05409d1195965a4dd6f48263300d9a

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

module GitCompound
  module Command
    module Arguments
      module Type
        # Abstract argument type
        #
        class Type
          def initialize(key, args)
            @key  = key
            @args = args
          end

          def parse
            valid? ? { @key => value } : {}
          end

          # Return true if arguments array contains
          # this parameter/argument, else - return false
          #
          def valid?
            raise NotImplementedError
          end

          # Returns array of arguments that has been used
          #
          def used
            raise NotImplementedError
          end

          private

          # Returns bare value extracted from args
          # or nil if bare arguments is irrelevant
          #
          def value!
            raise NotImplementedError
          end

          # Return value converted to valid type
          #
          def value
            raise NotImplementedError
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
git_compound-0.2.2 lib/git_compound/command/arguments/type/type.rb
git_compound-0.2.1 lib/git_compound/command/arguments/type/type.rb
git_compound-0.2.0 lib/git_compound/command/arguments/type/type.rb