Skip to content

Instantly share code, notes, and snippets.

@rpond-pa
Created July 18, 2013 21:59
Show Gist options
  • Save rpond-pa/6033492 to your computer and use it in GitHub Desktop.
Save rpond-pa/6033492 to your computer and use it in GitHub Desktop.
I had to see it for myself. From http://instacod.es/77752
$ irb
irb(main):001:0> class WhoIsAwesome
irb(main):002:1> YOU_ARE = "
irb(main):003:1" .-. . . . .-. .-. .-. . . .-.
irb(main):004:1" |-| | | | |- `-. | | |\/| |-
irb(main):005:1" ` ' `.'.' `-' `-' `-' ' ` `-' "
irb(main):006:1> define_method(YOU_ARE) do
irb(main):007:2* puts "This is insane"
irb(main):008:2> end
irb(main):009:1> end
=> #<Proc:0x007fea7306c8a8@(irb):6 (lambda)>
irb(main):010:0> WhoIsAwesome.new.send(WhoIsAwesome::YOU_ARE)
This is insane
=> nil
irb(main):011:0> WhoIsAwesome.new.methods
=> [:instance_exec, :=~, :tainted?, :methods, :__send__, :object_id, :kind_of?, :protected_methods, :untrust, :class, :!=, :extend, :tap, :public_methods, :trust, :clone, :instance_variable_get, :respond_to?, :initialize_dup, :<=>, :instance_eval, :instance_variable_defined?, :to_enum, :nil?, :inspect, :taint, :public_method, :send, :!~, :public_send, :instance_of?, :===, :singleton_methods, :untaint, :hash, :is_a?, :untrusted?, :private_methods, :singleton_class, :!, :equal?, :==, :display, :instance_variables, :freeze, :dup, :eql?, :__id__, :respond_to_missing?, :"\n .-. . . . .-. .-. .-. . . .-.\n |-| | | | |- `-. | | |/| |-\n ` ' `.'.' `-' `-' `-' ' ` `-' ", :instance_variable_set, :to_s, :initialize_clone, :method, :frozen?, :define_singleton_method, :enum_for]
class WhoIsAwesome
YOU_ARE = "
.-. . . . .-. .-. .-. . . .-.
|-| | | | |- `-. | | |\/| |-
` ' `.'.' `-' `-' `-' ' ` `-' "
define_method(YOU_ARE) do
puts "This is insane"
end
end
WhoIsAwesome.new.send(WhoIsAwesome::YOU_ARE)
WhoIsAwesome.new.methods
@rpond-pa
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment