Method: Hanami::Utils::Kernel.String
- Defined in:
- lib/hanami/utils/kernel.rb
permalink .String(arg) ⇒ String
Coerces the argument to be a String.
Identical behavior of Ruby’s Kernel.Array, still here because we want to keep the interface consistent
655 656 657 658 659 660 |
# File 'lib/hanami/utils/kernel.rb', line 655 def self.String(arg) arg = arg.to_str if arg.respond_to?(:to_str) super rescue NoMethodError raise TypeError.new "can't convert #{inspect_type_error(arg)}into String" end |