Created
July 29, 2008 13:39
-
-
Save walf443/3089 to your computer and use it in GitHub Desktop.
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
diff --git a/lib/jpmobile/mobile/abstract_mobile.rb b/lib/jpmobile/mobile/abstract_mobile.rb | |
index bdbaa13..2f88f11 100644 | |
--- a/lib/jpmobile/mobile/abstract_mobile.rb | |
+++ b/lib/jpmobile/mobile/abstract_mobile.rb | |
@@ -48,6 +48,16 @@ module Jpmobile::Mobile | |
return false | |
end | |
+ # XXX: lib/jpmobile.rbのautoloadで先に各キャリアの定数を定義してるからできるよ | |
+ Jpmobile::Mobile.constants.each do |career| | |
+ career_class = Jpmobile::Mobile.const_get(career) | |
+ next if self == career_class | |
+ | |
+ define_method "#{career.downcase}?" do | |
+ self.is_a?(career_class) | |
+ end | |
+ end | |
+ | |
private | |
# リクエストのパラメータ。 | |
def params |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment