Sha256: 9ec454f83e676e51e38e8c3bb040624078f5bad6d6b9bb987ba651d3eadc51c7

Contents?: true

Size: 553 Bytes

Versions: 10

Compression:

Stored size: 553 Bytes

Contents

module Preek
  #Lets monkey patch to have a default action with arguments!
  module DefaultCommand
    def dispatch(meth, given_args, given_opts, config)
      meth = retrieve_command_name(given_args)
      command = all_commands[normalize_command_name(meth)]
      unless command
        given_args.unshift meth
        meth = default_command
        command = all_commands[meth]
      end
      if given_args.empty? && command.name == default_command
        handle_argument_error(command, nil, given_args, nil)
      end
      super
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
preek-1.7.0 lib/preek/default_command.rb
preek-1.6.0 lib/preek/default_command.rb
preek-1.5.1 lib/preek/default_command.rb
preek-1.5.0 lib/preek/default_command.rb
preek-1.4.3 lib/preek/default_command.rb
preek-1.4.2 lib/preek/default_command.rb
preek-1.4.1 lib/preek/default_command.rb
preek-1.4.0 lib/preek/default_command.rb
preek-1.3.2 lib/preek/default_command.rb
preek-1.3.1 lib/preek/default_command.rb