Timeline for How to check whether a string contains a substring in Ruby
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 16, 2020 at 5:47 | comment | added | stwr667 |
Correct @theTinMan. "cde".in? my_string in pure Ruby yields NoMethodError . But with require 'active_support/core_ext/object/inclusion' it works, which can be loaded either from Rails itself or from the cut-down Active Support Core Extensions.
|
|
Feb 14, 2020 at 18:53 | comment | added | the Tin Man |
See stackoverflow.com/a/4239625/128421. It's in Rails, but is easily accessed from regular Ruby using Rails' Active Support Core Extensions which allow easy cherry-picking of small groups of methods such as only in? .
|
|
Feb 14, 2020 at 18:51 | history | edited | the Tin Man | CC BY-SA 4.0 |
Clean up messy links and improve readability
|
Nov 15, 2017 at 1:53 | comment | added | stwr667 | That's right, although since a significant proportion of Ruby developers are using Rails, I thought this might be a preferred solution for some due to its clarity and brevity. | |
Nov 15, 2017 at 1:49 | history | edited | stwr667 | CC BY-SA 3.0 |
Improved formatting. Clarifying language/framework.
|
Nov 13, 2017 at 23:42 | comment | added | dft | This relies on rails, the OP asked for a ruby solution | |
Apr 8, 2015 at 7:44 | history | answered | stwr667 | CC BY-SA 3.0 |