X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Factivesupport%2Flib%2Factive_support%2Fstring_inquirer.rb;fp=vendor%2Frails%2Factivesupport%2Flib%2Factive_support%2Fstring_inquirer.rb;h=e6b1f392251d726efce7fc4b19ef9fb4aca36d81;hb=437aa336c44c74a30aeea16a06743c32747ed661;hp=0000000000000000000000000000000000000000;hpb=97a0772b06264134cfe38e7494f9427efe0840a0;p=feedcatcher.git diff --git a/vendor/rails/activesupport/lib/active_support/string_inquirer.rb b/vendor/rails/activesupport/lib/active_support/string_inquirer.rb new file mode 100644 index 0000000..e6b1f39 --- /dev/null +++ b/vendor/rails/activesupport/lib/active_support/string_inquirer.rb @@ -0,0 +1,21 @@ +module ActiveSupport + # Wrapping a string in this class gives you a prettier way to test + # for equality. The value returned by Rails.env is wrapped + # in a StringInquirer object so instead of calling this: + # + # Rails.env == "production" + # + # you can call this: + # + # Rails.env.production? + # + class StringInquirer < String + def method_missing(method_name, *arguments) + if method_name.to_s[-1,1] == "?" + self == method_name.to_s[0..-2] + else + super + end + end + end +end