-
-
Save anonymous/8e355cca738fd1c9e753 to your computer and use it in GitHub Desktop.
class_methods ruby
This file contains 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 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