Class: Bundler::Patch::GemsToUpdate
- Inherits:
-
Object
- Object
- Bundler::Patch::GemsToUpdate
- Defined in:
- lib/bundler/patch/conservative_definition.rb
Instance Attribute Summary collapse
-
#gem_patches ⇒ Object
readonly
Returns the value of attribute gem_patches.
-
#patching ⇒ Object
readonly
Returns the value of attribute patching.
Instance Method Summary collapse
- #gem_patch_for(gem_name) ⇒ Object
-
#initialize(gem_patches, options = {}) ⇒ GemsToUpdate
constructor
A new instance of GemsToUpdate.
- #patching_but_not_this_gem?(gem_name) ⇒ Boolean
- #patching_gem?(gem_name) ⇒ Boolean
- #to_bundler_definition ⇒ Object
- #to_gem_names ⇒ Object
- #unlocking_all? ⇒ Boolean
- #unlocking_gem?(gem_name) ⇒ Boolean
Constructor Details
#initialize(gem_patches, options = {}) ⇒ GemsToUpdate
Returns a new instance of GemsToUpdate.
89 90 91 92 |
# File 'lib/bundler/patch/conservative_definition.rb', line 89 def initialize(gem_patches, ={}) @gem_patches = Array(gem_patches) @patching = [:patching] end |
Instance Attribute Details
#gem_patches ⇒ Object (readonly)
Returns the value of attribute gem_patches.
87 88 89 |
# File 'lib/bundler/patch/conservative_definition.rb', line 87 def gem_patches @gem_patches end |
#patching ⇒ Object (readonly)
Returns the value of attribute patching.
87 88 89 |
# File 'lib/bundler/patch/conservative_definition.rb', line 87 def patching @patching end |
Instance Method Details
#gem_patch_for(gem_name) ⇒ Object
110 111 112 |
# File 'lib/bundler/patch/conservative_definition.rb', line 110 def gem_patch_for(gem_name) @gem_patches.detect { |gp| gp.gem_name == gem_name } end |
#patching_but_not_this_gem?(gem_name) ⇒ Boolean
106 107 108 |
# File 'lib/bundler/patch/conservative_definition.rb', line 106 def patching_but_not_this_gem?(gem_name) @patching && !to_gem_names.include?(gem_name) end |
#patching_gem?(gem_name) ⇒ Boolean
102 103 104 |
# File 'lib/bundler/patch/conservative_definition.rb', line 102 def patching_gem?(gem_name) @patching && to_gem_names.include?(gem_name) end |
#to_bundler_definition ⇒ Object
94 95 96 |
# File 'lib/bundler/patch/conservative_definition.rb', line 94 def to_bundler_definition unlocking_all? ? true : {gems: to_gem_names} end |
#to_gem_names ⇒ Object
98 99 100 |
# File 'lib/bundler/patch/conservative_definition.rb', line 98 def to_gem_names @gem_patches.map(&:gem_name) end |
#unlocking_all? ⇒ Boolean
114 115 116 |
# File 'lib/bundler/patch/conservative_definition.rb', line 114 def unlocking_all? @patching || @gem_patches.empty? end |
#unlocking_gem?(gem_name) ⇒ Boolean
118 119 120 |
# File 'lib/bundler/patch/conservative_definition.rb', line 118 def unlocking_gem?(gem_name) unlocking_all? || to_gem_names.include?(gem_name) end |