Exception: Rip::VersionConflict
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Rip::VersionConflict
- Defined in:
- lib/rip/package_manager.rb
Instance Method Summary collapse
-
#initialize(name, bad_version, requester, real_version, owners) ⇒ VersionConflict
constructor
A new instance of VersionConflict.
- #message ⇒ Object (also: #to_s)
Constructor Details
#initialize(name, bad_version, requester, real_version, owners) ⇒ VersionConflict
Returns a new instance of VersionConflict.
9 10 11 12 13 14 15 |
# File 'lib/rip/package_manager.rb', line 9 def initialize(name, bad_version, requester, real_version, owners) @name = name @bad_version = bad_version @requester = requester @real_version = real_version @owners = owners end |
Instance Method Details
#message ⇒ Object Also known as: to_s
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rip/package_manager.rb', line 17 def = [] << "version conflict!" requested = "#{@name} requested at #{@bad_version}" requested += " by #{@requester}" if @requester << requested if @owners.size == 1 owners = @owners[0] elsif @owners.size == 2 owners = "#{@owners[0]} and #{@owners[1]}" elsif @owners.size > 2 owners = [ @owners[0...-1], "and #{@owners[-1]}" ].join(', ') end previously_requested = "#{@name} previously requested at #{@real_version}" previously_requested += " by #{owners}" if owners << previously_requested .join("\n") end |