class KafoModuleLint::TypeLoader

Attributes

modulepath[R]

Public Class Methods

new(modulepath) click to toggle source
# File lib/kafo_module_lint/type_loader.rb, line 8
def initialize(modulepath)
  @modulepath = modulepath

  # Workaround as DataTypeParser assumes KafoConfigure is in use
  Kafo::KafoConfigure.logger ||= Logger.new(STDERR)
end

Public Instance Methods

with_types() { || ... } click to toggle source
# File lib/kafo_module_lint/type_loader.rb, line 15
def with_types(&block)
  parsers = Dir[type_pattern].map { |manifest| Kafo::DataTypeParser.new(File.read(manifest)) }
  parsers.each(&:register)
  yield
ensure
  parsers.each do |parser|
    parser.types.keys.each { |type| Kafo::DataType.unregister_type(type) }
  end if parsers
end

Private Instance Methods

type_pattern() click to toggle source
# File lib/kafo_module_lint/type_loader.rb, line 27
def type_pattern
  File.join(modulepath, '*', 'types', '**' , '*.pp')
end