Module: RenderAsJs::ViewHelpers
- Defined in:
- lib/render_as_js/view_helpers.rb
Instance Method Summary collapse
Instance Method Details
#render_as_js(obj, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/render_as_js/view_helpers.rb', line 3 def render_as_js obj, ={} if obj.is_a?(Hash) return hash_to_js_obj obj elsif obj.is_a?(Array) return array_to_js_obj obj elsif obj.is_a?(Date) date_to_js_obj obj elsif obj.is_a?(DateTime) date_to_js_obj obj elsif obj.is_a?(String) string_to_js_obj obj elsif obj.is_a?(Symbol) symbol_to_js_obj obj, elsif obj.is_a?(NilClass) nil_to_js_obj obj else return sanitize(obj.to_s) end end |