Created
July 18, 2013 21:34
-
-
Save raphink/6033300 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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