Class: Bundler::Patch::GemsToPatch
- Inherits:
-
Object
- Object
- Bundler::Patch::GemsToPatch
- Defined in:
- lib/bundler/patch/conservative_definition.rb
Instance Attribute Summary collapse
-
#gem_patches ⇒ Object
readonly
Returns the value of attribute gem_patches.
Instance Method Summary collapse
- #gem_patch_for(gem_name) ⇒ Object
-
#initialize(gem_patches) ⇒ GemsToPatch
constructor
A new instance of GemsToPatch.
- #to_bundler_definition ⇒ Object
- #to_gem_names ⇒ Object
- #unlocking_all? ⇒ Boolean
- #unlocking_description ⇒ Object
- #unlocking_gem?(gem_name) ⇒ Boolean
Constructor Details
#initialize(gem_patches) ⇒ GemsToPatch
Returns a new instance of GemsToPatch.
112 113 114 115 |
# File 'lib/bundler/patch/conservative_definition.rb', line 112 def initialize(gem_patches) @gem_patches = Array(gem_patches) STDERR.puts "Unlocked gems: #{unlocking_description}" if ENV['DEBUG_PATCH_RESOLVER'] end |
Instance Attribute Details
#gem_patches ⇒ Object (readonly)
Returns the value of attribute gem_patches.
110 111 112 |
# File 'lib/bundler/patch/conservative_definition.rb', line 110 def gem_patches @gem_patches end |
Instance Method Details
#gem_patch_for(gem_name) ⇒ Object
125 126 127 |
# File 'lib/bundler/patch/conservative_definition.rb', line 125 def gem_patch_for(gem_name) @gem_patches.detect { |gp| gp.gem_name == gem_name } end |
#to_bundler_definition ⇒ Object
117 118 119 |
# File 'lib/bundler/patch/conservative_definition.rb', line 117 def to_bundler_definition unlocking_all? ? true : {gems: to_gem_names} end |
#to_gem_names ⇒ Object
121 122 123 |
# File 'lib/bundler/patch/conservative_definition.rb', line 121 def to_gem_names @gem_patches.map(&:gem_name) end |
#unlocking_all? ⇒ Boolean
129 130 131 |
# File 'lib/bundler/patch/conservative_definition.rb', line 129 def unlocking_all? @gem_patches.empty? end |
#unlocking_description ⇒ Object
137 138 139 |
# File 'lib/bundler/patch/conservative_definition.rb', line 137 def unlocking_description unlocking_all? ? 'ALL' : to_gem_names.sort.join(', ') end |
#unlocking_gem?(gem_name) ⇒ Boolean
133 134 135 |
# File 'lib/bundler/patch/conservative_definition.rb', line 133 def unlocking_gem?(gem_name) unlocking_all? || to_gem_names.include?(gem_name) end |