Skip to content

Instantly share code, notes, and snippets.

Created June 3, 2015 09:18
Show Gist options
  • Save anonymous/8e355cca738fd1c9e753 to your computer and use it in GitHub Desktop.
Save anonymous/8e355cca738fd1c9e753 to your computer and use it in GitHub Desktop.
class_methods ruby
class Foo
def initialize(params={})
params.each { |k,v| instance_variable_set "@#{k}", v }
end
def self.foo
print "Foo"
end
class << self
def baz; puts "Baz";end
end
end
%w{foo baz}.each do |meth| Foo.send(meth.to_sym); end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment