Actions
Feature #19466
closedClass.new takes a block, why doesn't Module.new take a block?
Status:
Closed
Assignee:
-
Target version:
-
Description
Class.new do
#... equivalent to class_eval
end
So, why don't we introduce:
Module.new do
#... equivalent to class_eval
end
Updated by sawa (Tsuyoshi Sawada) almost 2 years ago
It does.
A = Module.new do
def foo; "foo" end
end
class B; include A end
B.new.foo # => "foo"
Updated by ioquatix (Samuel Williams) almost 2 years ago
Ahh, I tried this but I must have made a mistake. So why does EnvUtil
not use this? Maybe it's legacy?
Updated by ioquatix (Samuel Williams) almost 2 years ago
- Status changed from Open to Closed
Okay, I confirmed it's working by my own hand, haha. I must work too hard this week, my brain is not functioning correctly.
I updated the PR to take advantage of that. In fact, it was right in front of me the whole time.
Actions
Like0
Like1Like0Like1