Class: Transdeps::Specification

Inherits:
Struct
  • Object
show all
Defined in:
lib/transdeps/specification.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



2
3
4
# File 'lib/transdeps/specification.rb', line 2

def name
  @name
end

#project_pathObject

Returns the value of attribute project_path

Returns:

  • (Object)

    the current value of project_path



2
3
4
# File 'lib/transdeps/specification.rb', line 2

def project_path
  @project_path
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



2
3
4
# File 'lib/transdeps/specification.rb', line 2

def version
  @version
end

Class Method Details

.from_lock(lock, path = '') ⇒ Object



3
4
5
6
# File 'lib/transdeps/specification.rb', line 3

def self.from_lock(lock, path='')
  match = lock.match(/^(?<name>[^\s]+) \((?<version>.*)\)/)
  new(match[:name], match[:version], path)
end

Instance Method Details

#=~(other) ⇒ Object



12
13
14
# File 'lib/transdeps/specification.rb', line 12

def =~(other)
  same_gem_as?(other) && version == other.version
end

#same_gem_as?(other) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/transdeps/specification.rb', line 8

def same_gem_as?(other)
  name == other.name
end

#to_sObject



16
17
18
# File 'lib/transdeps/specification.rb', line 16

def to_s
  "#{name} (#{version})"
end