Created
July 29, 2008 11:24
-
-
Save kirel/3068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
class A | |
def dsl &block | |
puts "dsl active" | |
instance_eval &block | |
end | |
private | |
def priv | |
puts "This is private - please stay out" | |
end | |
def method_missing(m, *arg) | |
puts "I #{m} #{arg.first}." | |
end | |
end | |
a = A.new | |
a.dsl do | |
priv | |
write "something" | |
yell "something" | |
scream "something" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment