Class: Transdeps::SpecList

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lock_file_path, lock_file_contents, parser = Bundler::LockfileParser.new(lock_file_contents.to_s)) ⇒ SpecList

Returns a new instance of SpecList.



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

def initialize(lock_file_path, lock_file_contents, parser=Bundler::LockfileParser.new(lock_file_contents.to_s))
  lock_file_path = Pathname(lock_file_path)
  super(lock_file_path, lock_file_contents, parser)
end

Instance Attribute Details

#lock_file_contentsObject

Returns the value of attribute lock_file_contents

Returns:

  • (Object)

    the current value of lock_file_contents



6
7
8
# File 'lib/transdeps/spec_list.rb', line 6

def lock_file_contents
  @lock_file_contents
end

#lock_file_pathObject

Returns the value of attribute lock_file_path

Returns:

  • (Object)

    the current value of lock_file_path



6
7
8
# File 'lib/transdeps/spec_list.rb', line 6

def lock_file_path
  @lock_file_path
end

#parserObject

Returns the value of attribute parser

Returns:

  • (Object)

    the current value of parser



6
7
8
# File 'lib/transdeps/spec_list.rb', line 6

def parser
  @parser
end

Instance Method Details

#-(other) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/transdeps/spec_list.rb', line 18

def -(other)
  specs.map do |spec|
    next unless other[spec.name]
    unless spec =~ other[spec.name]
      Inconsistency.new(spec, other[spec.name])
    end
  end.compact
end

#[](name) ⇒ Object



27
28
29
# File 'lib/transdeps/spec_list.rb', line 27

def [](name)
  specs.find{|spec| spec.name == name }
end

#specsObject



12
13
14
15
16
# File 'lib/transdeps/spec_list.rb', line 12

def specs
  parser.specs.map do |spec|
    Specification.from_lock(spec.to_s, lock_file_path.dirname.to_s)
  end
end