Class: Librarian::Lockfile

Inherits:
Object
  • Object
show all
Defined in:
lib/librarian/lockfile.rb,
lib/librarian/lockfile/parser.rb,
lib/librarian/lockfile/compiler.rb

Defined Under Namespace

Classes: Compiler, Parser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment, path) ⇒ Lockfile

Returns a new instance of Lockfile


11
12
13
14
# File 'lib/librarian/lockfile.rb', line 11

def initialize(environment, path)
  self.environment = environment
  @path = path
end

Instance Attribute Details

#environmentObject

Returns the value of attribute environment


7
8
9
# File 'lib/librarian/lockfile.rb', line 7

def environment
  @environment
end

#pathObject (readonly)

Returns the value of attribute path


9
10
11
# File 'lib/librarian/lockfile.rb', line 9

def path
  @path
end

Instance Method Details

#load(string) ⇒ Object


20
21
22
# File 'lib/librarian/lockfile.rb', line 20

def load(string)
  Parser.new(environment).parse(string)
end

#readObject


24
25
26
# File 'lib/librarian/lockfile.rb', line 24

def read
  load(path.read)
end

#save(resolution) ⇒ Object


16
17
18
# File 'lib/librarian/lockfile.rb', line 16

def save(resolution)
  Compiler.new(environment).compile(resolution)
end