Class: Librarian::Lockfile
- Inherits:
-
Object
- Object
- Librarian::Lockfile
- Defined in:
- lib/librarian/lockfile.rb,
lib/librarian/lockfile/parser.rb,
lib/librarian/lockfile/compiler.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(environment, path) ⇒ Lockfile
constructor
A new instance of Lockfile.
- #load(string) ⇒ Object
- #read ⇒ Object
- #save(resolution) ⇒ Object
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
#environment ⇒ Object
Returns the value of attribute environment.
7 8 9 |
# File 'lib/librarian/lockfile.rb', line 7 def environment @environment end |
#path ⇒ Object (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 |
#read ⇒ Object
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 |