Class/Module Index [+]

Quicksearch

Facter::Util::Parser

Public Class Methods

extension_matches?(filename, ext) click to toggle source

For support mutliple extensions you can pass an array of extensions as ext.

# File lib/facter/util/parser.rb, line 13
def self.extension_matches?(filename, ext)
  extension = case ext
  when String
    ext.downcase
  when Enumerable
    ext.collect {|x| x.downcase }
  end
  [extension].flatten.to_a.include?(file_extension(filename).downcase)
end
file_extension(filename) click to toggle source
# File lib/facter/util/parser.rb, line 23
def self.file_extension(filename)
  File.extname(filename).sub(".", '')
end
parser_for(filename) click to toggle source
# File lib/facter/util/parser.rb, line 31
def self.parser_for(filename)
  registration = @parsers.detect { |k| k[1].call(filename) }

  if registration.nil?
    NothingParser.new
  else
    registration[0].new(filename)
  end
end
register(klass, &suitable) click to toggle source
# File lib/facter/util/parser.rb, line 27
def self.register(klass, &suitable)
  @parsers << [klass, suitable]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.