Module: TinyDyno::Attributes::ClassMethods
- Defined in:
- lib/tiny_dyno/attributes.rb
Instance Method Summary collapse
-
#document_typed(klass:, value:) ⇒ Object
convert to the type used on the Document.
Instance Method Details
#document_typed(klass:, value:) ⇒ Object
convert to the type used on the Document
145 146 147 148 149 150 151 152 153 |
# File 'lib/tiny_dyno/attributes.rb', line 145 def document_typed(klass:, value: ) if klass == String value.blank? ? nil : value.to_s elsif (klass == Integer or klass == Fixnum ) value.to_i else value end end |