Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # // Onbound Methods
- =begin
- class Onbound
- def put_cookies
- print "Cookies"
- end
- $cookies = self.instance_method(:put_cookies)
- end
- class Onbound2 < Onbound
- def put_cookies
- print "Moar Cookies"
- end
- end
- Onbound.new.put_cookies
- $cookies.bind(Onbound.new).call
- Onbound2.new.put_cookies
- $cookies.bind(Onbound2.new).call
- =end
- # // Proc Class Replica
- =begin
- class Proc_Replica
- def initialize(&block)
- @___block = block
- class << self
- define_method(:call) do |*args|
- @___block.call(*args)
- end
- end
- end
- end
- pro = Proc_Replica.new { |something| print something }
- pro2 = Proc_Replica.new { |a, b| print a+b }
- pro.call("Something")
- pro2.call(1, 2)
- =end
- # // Err Eval
- =begin
- class ModTest
- class_eval <<-EOM
- def self.print_cookies
- print "Cookies"
- end
- EOM
- end
- ModTest.print_cookies
- =end
- # // Struct
- =begin
- str = Struct.new(:wtf, :htf)
- strt = str.new(0, 1)
- strt.each { |p| print p }
- =end
Advertisement
Add Comment
Please, Sign In to add comment