Class: String

Inherits:
Object
  • Object
show all
Defined in:
omf_common/lib/omf_common/core_ext/string.rb

Overview

Copyright © 2012 National ICT Australia Limited (NICTA). This software may be used and distributed solely under the terms of the MIT license (License). You should find a copy of the License in LICENSE.TXT or at opensource.org/licenses/MIT. By downloading or using this software you accept the terms and the liability disclaimer in the License.

Instance Method Summary (collapse)

Instance Method Details

- (Object) ducktype



7
8
9
10
# File 'omf_common/lib/omf_common/core_ext/string.rb', line 7

def ducktype
  return self if self =~ /^0.+/
  Integer(self) rescue Float(self) rescue self
end