Module: StringHelper
- Defined in:
- lib/string_helper.rb
Class Method Summary collapse
Class Method Details
.add_method_to_id(strings, as_array = true) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/string_helper.rb', line 3 def add_method_to_id(strings, as_array=true) return nil unless strings strings.map do |string| if string.is_a?(Array) add_method_to_id(string, false) else def string.to_id "#{self}_id" end as_array ? [string] : string end end end |