Class: Bundler::Patch::GemsToPatch

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/patch/conservative_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_patches) ⇒ GemsToPatch

Returns a new instance of GemsToPatch.



89
90
91
# File 'lib/bundler/patch/conservative_definition.rb', line 89

def initialize(gem_patches)
  @gem_patches = Array(gem_patches)
end

Instance Attribute Details

#gem_patchesObject (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

Instance Method Details

#gem_patch_for(gem_name) ⇒ Object



101
102
103
# File 'lib/bundler/patch/conservative_definition.rb', line 101

def gem_patch_for(gem_name)
  @gem_patches.detect { |gp| gp.gem_name == gem_name }
end

#to_bundler_definitionObject



93
94
95
# File 'lib/bundler/patch/conservative_definition.rb', line 93

def to_bundler_definition
  unlocking_all? ? true : {gems: to_gem_names}
end

#to_gem_namesObject



97
98
99
# File 'lib/bundler/patch/conservative_definition.rb', line 97

def to_gem_names
  @gem_patches.map(&:gem_name)
end

#unlocking_all?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/bundler/patch/conservative_definition.rb', line 105

def unlocking_all?
  @gem_patches.empty?
end

#unlocking_gem?(gem_name) ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/bundler/patch/conservative_definition.rb', line 109

def unlocking_gem?(gem_name)
  unlocking_all? || to_gem_names.include?(gem_name)
end