PageRenderTime 43ms CodeModel.GetById 38ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/tools/Ruby/lib/ruby/site_ruby/1.8/rubygems/errors.rb

http://github.com/agross/netopenspace
Ruby | 35 lines | 22 code | 7 blank | 6 comment | 2 complexity | 0e60678c90200e0eea2a650afc9494c2 MD5 | raw file
 1class Gem::ErrorReason; end
 2
 3# Generated when trying to lookup a gem to indicate that the gem
 4# was found, but that it isn't usable on the current platform.
 5#
 6# fetch and install read these and report them to the user to aid
 7# in figuring out why a gem couldn't be installed.
 8#
 9class Gem::PlatformMismatch < Gem::ErrorReason
10
11  attr_reader :name
12  attr_reader :version
13  attr_reader :platforms
14
15  def initialize(name, version)
16    @name = name
17    @version = version
18    @platforms = []
19  end
20
21  def add_platform(platform)
22    @platforms << platform
23  end
24
25  def wordy
26    prefix = "Found #{@name} (#{@version})"
27
28    if @platforms.size == 1
29      "#{prefix}, but was for platform #{@platforms[0]}"
30    else
31      "#{prefix}, but was for platforms #{@platforms.join(' ,')}"
32    end
33  end
34
35end