Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created September 8, 2010 17:39
Show Gist options
  • Save jackdempsey/570479 to your computer and use it in GitHub Desktop.
Save jackdempsey/570479 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
class Foo
def self.facing(arg)
puts "in facing with arg #{arg}"
end
{:front => 'A', :back => 'AB', :left => 'AA', :right => 'AC'}.each_pair do |side, letters|
instance_eval %{ def self.#{side}_facing; facing '#{letters}'; end }
end
end
p Foo.singleton_methods.sort
p Foo.front_facing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment