Class: Bump::CLI::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/bump/cli/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, import_external_references: false) ⇒ Definition

Returns a new instance of Definition.



9
10
11
12
13
# File 'lib/bump/cli/definition.rb', line 9

def initialize(path, import_external_references: false)
  @path = path
  @import_external_references = import_external_references
  @external_references = References.new(root_path: find_base_path(path))
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



7
8
9
# File 'lib/bump/cli/definition.rb', line 7

def content
  @content
end

#external_referencesObject (readonly)

Returns the value of attribute external_references.



7
8
9
# File 'lib/bump/cli/definition.rb', line 7

def external_references
  @external_references
end

Instance Method Details

#prepare!Object



15
16
17
18
19
20
21
# File 'lib/bump/cli/definition.rb', line 15

def prepare!
  @content = Resource.read(path)

  if import_external_references
    external_references.load(Resource.parse(content))
  end
end