Module: Gem::LocalRemoteOptions

Included in:
InstallCommand, QueryCommand, SpecificationCommand
Defined in:
lib/rubygems/gem_commands.rb

Overview

Mixin methods for handling the local/remote command line options.

Instance Method Summary collapse

Instance Method Details

#add_local_remote_optionsObject

Add the local/remote options to the command line parser.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/rubygems/gem_commands.rb', line 67

def add_local_remote_options
  add_option('-l', '--local',
             'Restrict operations to the LOCAL domain'
             ) do |value, options|
    options[:domain] = :local
  end

  add_option('-r', '--remote',
    'Restrict operations to the REMOTE domain') do
    |value, options|
    options[:domain] = :remote
  end

  add_option('-b', '--both',
    'Allow LOCAL and REMOTE operations') do
    |value, options|
    options[:domain] = :both
  end
end

#local?Boolean

Is local fetching enabled?

Returns:

  • (Boolean)


88
89
90
# File 'lib/rubygems/gem_commands.rb', line 88

def local?
  options[:domain] == :local || options[:domain] == :both
end

#remote?Boolean

Is remote fetching enabled?

Returns:

  • (Boolean)


93
94
95
# File 'lib/rubygems/gem_commands.rb', line 93

def remote?
  options[:domain] == :remote || options[:domain] == :both
end