Sha256: f6851febd2b720ff7deb02dd72e38677a94842ad57994eade730405c951c3afd

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2010, Sebastian Staudt

require 'rubikon/parameter'

module Rubikon

  # A flag is an application parameter without arguments
  #
  # @author Sebastian Staudt
  # @see Application::InstanceMethods#flag
  # @see Application::InstanceMethods#global_flag
  # @see Parameter
  # @since 0.3.0
  class Flag

    include Parameter

    private

    # Adds an argument to this flag
    #
    # @param arg (see Parameter#<<)
    # @raise [ExtraArgumentError] is raised because flags never take any
    #                             arguments.
    def <<(arg)
      raise ExtraArgumentError.new(@name)
    end

    # Checks whether this flag has all required arguments supplied
    #
    # @return [true] This is always +true+ because flags never take any
    #                arguments.
    def args_full?
      true
    end

    # Checks whether this flag can take more arguments
    #
    # @return [false] This is always +false+ because flags never take any
    #                 arguments.
    def more_args?
      false
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubikon-0.5.1 lib/rubikon/flag.rb
rubikon-0.5.0 lib/rubikon/flag.rb