Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/sitefuel/extensions/DynamicClassMethods.rb
Overview
- File
-
DynamicClassMethods.rb
- Author
-
wkm
- Copyright
-
2009, Zanoccio LLC.
- License
-
GPL version 2.0 (see LICENSE.rb)
Adds a #meta_def function to Object so we can programmatically define class methods.
Instance Method Summary collapse
-
#define_class_method(name, &blk) ⇒ Object
defines a class method based on: blog.jayfields.com/2007/10/ruby-defining-class-methods.html and: whytheluckystiff.net/articles/seeingMetaclassesClearly.html.
Instance Method Details
#define_class_method(name, &blk) ⇒ Object
defines a class method based on: blog.jayfields.com/2007/10/ruby-defining-class-methods.html and: whytheluckystiff.net/articles/seeingMetaclassesClearly.html
16 17 18 |
# File 'lib/sitefuel/extensions/DynamicClassMethods.rb', line 16 def define_class_method name, &blk (class << self; self; end).instance_eval { define_method name, &blk} end |