Skip to content

Instantly share code, notes, and snippets.

@raphink
Created July 18, 2013 21:34
Show Gist options
  • Save raphink/6033300 to your computer and use it in GitHub Desktop.
Save raphink/6033300 to your computer and use it in GitHub Desktop.
# Define a method using augopen
#
# @param [Symbol] meth the name of the method to create
# @yield [aug] block that uses the Augeas handle
# @yieldparam [Augeas] aug open Augeas handle
# @api public
def define_augmethod(meth, &block)
define_method(meth) do
instance_exec augopen, &block
end
# Also define for the class
self.class.define_augmethod(meth, self.resource, &block)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment