module Bibliothecary::Analyser::ClassMethods

Public Instance Methods

add_multi_parser(klass) click to toggle source

Add a MultiParser module to a Parser class. This extends the self.mapping method on the parser to include the multi parser’s files to watch for, and it extends the Parser class with the multi parser for you.

@param klass [Class] A Bibliothecary::MultiParsers class

# File lib/bibliothecary/analyser.rb, line 75
def add_multi_parser(klass)
  raise "No mapping found! You should place the add_multi_parser call below def self.mapping." unless respond_to?(:mapping)

  original_mapping = self.mapping

  define_singleton_method(:mapping) do
    original_mapping.merge(klass.mapping)
  end

  send(:extend, klass)
end
generic?() click to toggle source
# File lib/bibliothecary/analyser.rb, line 51
def generic?
  platform_name == "generic"
end
map_dependencies(hash, key, type) click to toggle source
# File lib/bibliothecary/analyser.rb, line 59
def map_dependencies(hash, key, type)
  hash.fetch(key,[]).map do |name, requirement|
    Dependency.new(
      name: name,
      requirement: requirement,
      type: type,
    )
  end
end
platform_name() click to toggle source
# File lib/bibliothecary/analyser.rb, line 55
def platform_name
  self.name.to_s.split("::").last.downcase
end