Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
[B! Rails][configure] takaesuのブックマーク
[go: Go Back, main page]

タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

Railsとconfigureに関するtakaesuのブックマーク (1)

  • Ruby Gem Configuration Pattern

    railsのgemでよくみかける初期設定ファイル、config/initializers/foo.rb。このような初期設定のインターフェースをgem内に作る場合、いったいどうしたら良いでしょうか。 めざす完成形はコレ!完成系として、下記を想定してみます。 # config/initializers/konfig.rb Konfig.configure do |config| config.my_value = 'my configuration value' endconfigureメソッドを用意まずはmoduleとconfigureというクラスメソッドを用意します。 module Konfig class << self def configure end end endConfigurationクラス次に実際の設定値が入るConfigurationクラスを用意します。 class Co

    Ruby Gem Configuration Pattern
  • 1