LoginSignup
9
7

More than 5 years have passed since last update.

Rails.env.test?みたいなやつを普通の文字列でもヤりたい

Posted at
a= 'hoge'
a.hoge? # NoMethodError: undefined method `hoge?' for "hoge":String
a = ActiveSupport::StringInquirer.new('hoge')
a.hoge? # => true

アホ毛がtrueに!

ActiveSupportのStringInquirerというClassの機能みたいです。

@udzura 先生が教えてくれました。ありがとうございます!

9
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7