Class: PuppetfileResolver::Puppetfile::Parser::R10KEval::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/puppetfile-resolver/puppetfile/parser/r10k_eval/dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(puppetfile_document) ⇒ DSL

Returns a new instance of DSL.



10
11
12
# File 'lib/puppetfile-resolver/puppetfile/parser/r10k_eval/dsl.rb', line 10

def initialize(puppetfile_document)
  @document = puppetfile_document
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *_args) ⇒ Object

rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing

Raises:

  • (NoMethodError)


36
37
38
# File 'lib/puppetfile-resolver/puppetfile/parser/r10k_eval/dsl.rb', line 36

def method_missing(method_name, *_args) # rubocop:disable Style/MethodMissingSuper, Style/MissingRespondToMissing
  raise NoMethodError, "Unknown method #{method_name}"
end

Instance Method Details

#forge(location) ⇒ Object

Parameters:

  • forge (String)


28
29
30
# File 'lib/puppetfile-resolver/puppetfile/parser/r10k_eval/dsl.rb', line 28

def forge(location)
  @document.forge_uri = location
end

#mod(name, args = nil) ⇒ Object

Parameters:

  • name (String)
  • args (*Object) (defaults to: nil)


16
17
18
19
20
21
22
23
24
25
# File 'lib/puppetfile-resolver/puppetfile/parser/r10k_eval/dsl.rb', line 16

def mod(name, args = nil)
  # Get the module object
  mod = PuppetModule.from_puppetfile(name, args)
  # Inject the file location
  line_num = find_load_line_number
  mod.location.start_line = line_num
  mod.location.end_line = line_num
  # Append to the list of modules
  @document.add_module(mod)
end

#moduledir(_location) ⇒ Object

Parameters:

  • moduledir (String)


33
34
# File 'lib/puppetfile-resolver/puppetfile/parser/r10k_eval/dsl.rb', line 33

def moduledir(_location)
end