ï¼ãã©ã¤ãæï¼ Foo.configure do |config| config.name = "foo" config.email = "[email protected]" end ãã£ã¡ã§ãããããããã Foo.config.name = "foo" Foo.config.email = "[email protected]" ãããããã¤ã å®è£ ã¯å¤§ä½ããããæãã«ãªã£ã¦ãã module Foo class << self def configure yield config end def config @_config ||= Config.new end end class Config attr_accessor :name, :email def initialize @name = "no name" @email = "[email protected]" end e
{{#tags}}- {{label}}
{{/tags}}