Ruby 1.8.7 リファレンスマニュアル > ライブラリ一覧 > yamlライブラリ > YAMLモジュール > detect_implicit
detect_implicit(val) -> String
[permalink][rdoc]タグを省略した値の型を判定します。
require 'yaml' p YAML.detect_implicit("") # => "null" p YAML.detect_implicit("Cat") # => "str" p YAML.detect_implicit("true") # => "bool#yes" p YAML.detect_implicit("10") # => "int" p YAML.detect_implicit("0x10") # => "int#hex"