Skip to content

Instantly share code, notes, and snippets.

@joshuaclayton
Forked from nbryan/gist:221412
Created October 29, 2009 13:26
Show Gist options
  • Save joshuaclayton/221443 to your computer and use it in GitHub Desktop.
Save joshuaclayton/221443 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment