summaryrefslogtreecommitdiff
path: root/test/ruby/namespace/open_class_with_include.rb
blob: ad8fd58ea03d085a4a0153d38f4f33aa0f336645 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module StringExt
  FOO = "foo 1"
  def say_foo
    "I'm saying " + FOO
  end
end

class String
  include StringExt
  def say
    say_foo
  end
end

module OpenClassWithInclude
  def self.say
    String.new.say
  end

  def self.say_foo
    String.new.say_foo
  end

  def self.say_with_obj(str)
    str.say
  end

  def self.refer_foo
    String::FOO
  end
end