Module: Kernel
- Defined in:
- lib/cuts/cut.rb
Instance Method Summary collapse
-
#cut(klass, &block) ⇒ Object
Cut convienence method.
Instance Method Details
#cut(klass, &block) ⇒ Object
Cut convienence method.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/cuts/cut.rb', line 124 def cut(klass, &block) case klass when Array name, klass = *klass else name = nil end cut = Cut.new(klass, &block) # How to handle main, but not other instance spaces? #klass.modspace::const_set(klass.basename, cut) mod = (Module === self ? self : Object) mod.const_set(name, cut) if name # <<- this is what we don't have in Cut.new return cut end |