Fork Of

Revisions

gist: 221443 Download_button fork
public
Public Clone URL: git://gist.github.com/221443.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Person
  def self.region(str, &blk)
    self.class_eval(&blk)
  end
end
 
class Joe < Person
  def name; "Joe"; end
 
  region "speaking" do
    def say_hi
      "Hi"
    end
 
    def say_hi_to(someone)
      return say_hi if someone.blank?
      "#{say_hi}, #{someone}"
    end
  end
end