Created
December 14, 2010 14:11
-
-
Save kitallis/740467 to your computer and use it in GitHub Desktop.
PratulKalia can do a lot of things.
This file contains hidden or 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
class PratulKalia | |
class << self | |
def should(&sblk) | |
self.new.instance_eval(&sblk) | |
end | |
end | |
end | |
class Blabber | |
def things(arg) | |
puts "Pratul Kalia should fucken stop blabbering about things like: #{arg.join(", ")}" | |
end | |
def like(*arg) | |
arg | |
end | |
end | |
class Calculate | |
def initialize | |
["expression", "statement", "problem"].map {|m| | |
class << self | |
self | |
end.send(:define_method, m) {|arg| | |
puts "Pratul Kalia thinks that #{arg}is #{eval arg}" | |
} | |
} | |
end | |
def method_missing(meth, arg = nil, &block) | |
"#{value(meth)} #{arg}" | |
end | |
def value(number) | |
{:one => 1, :two => 2, :three => 3, :four => 4, :five => 5, :six => 6, :seven => 7, | |
:eight => 8, :nine => 9, :zero => 0}.fetch(number) | |
end | |
def times(args) | |
"* #{args}" | |
end | |
def by(args) | |
"/ #{args}" | |
end | |
def from(args) | |
"- #{args}" | |
end | |
def with(args) | |
"+ #{args}" | |
end | |
end | |
class Symbol | |
def this(&sblk) | |
if self == :calculate | |
Calculate.new.instance_eval(&sblk) | |
end | |
if self == :print | |
puts "Pratul Kalia says #{yield}" | |
end | |
end | |
def about(&blk) | |
if self == :shutup | |
Blabber.new.instance_eval(&blk) | |
end | |
end | |
end | |
PratulKalia.should { | |
:print.this { "I AM AWESOME" } & :calculate.this { expression four times three with two } & :shutup.about { things like "FONTS", "OS X", "Sneha" }\ | |
& :calculate.this { statement eight by four with three } | |
} |
PratulKalia.should {
:ensure.this { "kitallis dies in an accident." }
}
rofl :-P
XD
epic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i can lol