Class: BundleUpdateInteractive::LockfileEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_update_interactive/lockfile_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec, exact_dependencies, exact_requirement) ⇒ LockfileEntry

Returns a new instance of LockfileEntry.



7
8
9
10
11
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 7

def initialize(spec, exact_dependencies, exact_requirement)
  @spec = spec
  @exact_dependencies = exact_dependencies
  @exact_requirement = exact_requirement
end

Instance Attribute Details

#exact_dependenciesObject (readonly)

Returns the value of attribute exact_dependencies.



5
6
7
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 5

def exact_dependencies
  @exact_dependencies
end

#specObject (readonly)

Returns the value of attribute spec.



5
6
7
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 5

def spec
  @spec
end

Instance Method Details

#exact_requirement?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 31

def exact_requirement?
  @exact_requirement
end

#git_source?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 43

def git_source?
  !!git_version
end

#git_source_uriObject



39
40
41
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 39

def git_source_uri
  spec.source.uri if git_source?
end

#git_versionObject



35
36
37
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 35

def git_version
  spec.git_version&.strip
end

#nameObject



13
14
15
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 13

def name
  spec.name
end

#older_than?(updated_entry) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 21

def older_than?(updated_entry)
  return false if updated_entry.nil?

  if git_source? && updated_entry.git_source?
    version <= updated_entry.version && git_version != updated_entry.git_version
  else
    version < updated_entry.version
  end
end

#rubygems_source?Boolean

Returns:

  • (Boolean)


47
48
49
50
51
52
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 47

def rubygems_source?
  return false if git_source?

  source = spec.source
  source.respond_to?(:remotes) && source.remotes.map(&:to_s).include?("https://rubygems.org/")
end

#versionObject



17
18
19
# File 'lib/bundle_update_interactive/lockfile_entry.rb', line 17

def version
  spec.version
end