Class: PuppetGenerator::Middleware::CheckForEmptySource

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_generator/middleware/check_for_empty_source.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ CheckForEmptySource

Returns a new instance of CheckForEmptySource.



4
5
6
# File 'lib/puppet_generator/middleware/check_for_empty_source.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(task) ⇒ Object



8
9
10
11
12
13
# File 'lib/puppet_generator/middleware/check_for_empty_source.rb', line 8

def call(task)
  PuppetGenerator.logger.debug(self.class.name){ "Checking if given source \"#{task.meta[:source]}\" is empty." }
  raise PuppetGenerator::Exceptions::EmptySource if task.body.empty?

  @app.call(task)
end