Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/authy/core_ext.rb
Class Method Summary collapse
Class Method Details
.try_convert(value) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/authy/core_ext.rb', line 15 def self.try_convert(value) return value if value.instance_of?(Array) return nil if !value.respond_to?(:to_ary) converted = value.to_ary return converted if converted.instance_of?(Array) cname = value.class.name raise TypeError, "can't convert %s to %s (%s#%s gives %s)" % [cname, Array.name, cname, :to_ary, converted.class.name] end |