Sha256: 07867ba511a8637b6c607f80b4172b6d2ff8810cf3361c511ec4ad36ccce436b
Contents?: true
Size: 517 Bytes
Versions: 1
Compression:
Stored size: 517 Bytes
Contents
require "curly_mustache/attributes/types" types = CurlyMustache::Attributes::Types types.define(:integer){ |value| Integer(value) rescue 0 } types.define(:string){ |value| String(value) rescue "" } types.define(:float){ |value| Float(value) rescue 0.0 } types.define(:boolean){ |value| !!value } types.define(:time) do |value| if value.kind_of?(Time) value elsif value.kind_of?(String) Time.parse(value) elsif value.kind_of?(Integer) or value.kind_of?(Float) Time.at(value) else nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
curly_mustache-0.1.0 | lib/curly_mustache/default_types.rb |