Project

General

Profile

Actions

Bug #7262

closed

module extension (#include/#prepend) in refinements

Added by matz (Yukihiro Matsumoto) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0dev (2012-11-01 trunk 37415) [i486-linux]
Backport:
[ruby-dev:46346]

Description

refinementの中でモジュールのincludeやprependがしたい(かつ、そのスコープの範囲内だけで有効にしたい)なんて思ったんですが、きっと困難ですよね。
「無理」と思ったら遠慮なくrejectしてください。

module Experiment
refine String do
include Enumerable
def foo; p :foo; end
end
end

using Experiment
"foo".foo
"foo".each(&:p)

Matz.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0