Skip to content

Instantly share code, notes, and snippets.

@reinh
Created September 9, 2009 23:24
Show Gist options
  • Save reinh/184167 to your computer and use it in GitHub Desktop.
Save reinh/184167 to your computer and use it in GitHub Desktop.
module Facter
def self.add(name, &block)
collection.add(name, &block) # eventually becomes Factor::Util::Resolvers.instance_eval(block)
end
end
class Factor::Util::Resolvers
class << self
def setcode(string=nil, &block)
return Facter::Util::Resolvers::Exec.new(string) if string
return Facter::Util::Resolvers::Proc.new(block) if block
raise ArgumentError, "You must pass either code or a block"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment