Giter Club home page Giter Club logo

Comments (6)

darkside avatar darkside commented on July 21, 2024

From the top of my head I'd say ActiveSupport core extensions. You can roll your own as_json for Hash, obviously.

from georuby.

parkr avatar parkr commented on July 21, 2024

It's just:

class Hash
  def as_json(opts = {})
    self
  end
end

ya? Seems like a a good idea to add that to this project in case we're not working with Active*.

from georuby.

darkside avatar darkside commented on July 21, 2024

Yup, we could have something like that as a default Hash extension if ActiveSupport (or the method) is not present.

from georuby.

nofxx avatar nofxx commented on July 21, 2024

I've pushed some clean ups and changes. Please provide a use case @parkr , just need a spec to understand this part of the code ;)

from georuby.

parkr avatar parkr commented on July 21, 2024

@nofxx I was writing out GeoJSON, like so: https://github.com/parkr/would-patronize-again/blob/master/lib/patronize.rb

I got the above error when trying to turn the geographic information into GeoJSON and writing it out to a file.

from georuby.

nofxx avatar nofxx commented on July 21, 2024

Hello @parkr, should be working fine now. (v2.5.1)
No need for ActiveWhatever, #to_json is from 'json' gem:

*>   {a: 1}.to_json
=> "{"a":1}"
>> JSON
=> JSON
>> ActiveSupport
NameError: uninitialized constant ActiveSupport
    from (irb):4
    from /usr/bin/irb:11:in `<main>'

from georuby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.