Top Level Namespace

Defined Under Namespace

Classes: Contacts

Instance Method Summary collapse

Instance Method Details

#rubygemsObject

Use ActiveSupport’s version of JSON if available if Object.const_defined?(‘ActiveSupport’) && ActiveSupport.const_defined?(‘JSON’)

module ActiveSupportJsonParseFunction
  def parse(i)
    ActiveSupport::JSON.decode(i)
  end
end
# newer versions of ActiveSupport define a root JSON module to extend...
if Object.const_defined?('JSON')
  JSON.send(:extend, ActiveSupportJsonParseFunction)
else
  # ... older need it defined from scratch
  class JSON
    extend ActiveSupportJsonParseFunction
  end
end

else

require 'json/add/rails'

end



23
# File 'lib/contacts.rb', line 23

require 'rubygems'