aboutsummaryrefslogtreecommitdiffstats
path: root/test/with_diffent_ofs.rb
blob: c3f6a4acc77670939c997434743fbb7f5d4c52f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module DifferentOFS
  def setup
    super
    @ofs, $, = $,, "-"
  end
  def teardown
    $, = @ofs
    super
  end

  mod = Module.new do
    def with_diffrent_ofs
      const_set(:DifferentOFS, Class.new(self).class_eval {include DifferentOFS}).name
    end
  end
  class << self; self; end.class_eval do
    define_method(:included) do |klass|
      super(klass)
      klass.extend(mod)
    end
  end
end