GithubHelp home page GithubHelp logo

hjson-rb's Issues

Relax dependency requirement on JSON

Hi,
I am trying to migrate from JSON to HJSON for config files of my app and I am running into an issue with JSON gem compatibility as HJSON gem requires JSON ~> 2.2.0 while some of the other gems I am using are locked down on older versions of the JSON gem.

Would it be possible to relax the current requirement to a less strict that allows for older versions? I tried to build this gem locally with:
spec.add_runtime_dependency 'json', '>= 1.7.5'
and it seems to be working just fine. I can create a pull request if that would help.

hjson-rb does not work with ruby 3

[1] pry(main)> require 'hjson'
=> true
[2] pry(main)> Hjson.parse "1"
ArgumentError: wrong number of arguments (given 2, expected 1)
from /home/app/.rvm/gems/ruby-3.0.1/gems/hjson-0.1.2/lib/hjson/ast/parser.rb:41:in `initialize'
[3] pry(main)> RUBY_VERSION
=> "3.0.1"

I understand it is because of separation of positional and keyword arguments in Ruby 3.0. Sorry I don't know Ruby well to fix it and submit a pull request.

Gem out of date

Rubygems has the initial version which was last updated August 07, 2016 and does not contain any of the patches since. Can you please bump the version and submit it?

shadowing outer local variable

When I try to load hjson I get the following warning:

/var/lib/gems/2.3.0/gems/hjson-0.1.0/lib/hjson/ast/nodes/string.rb:48: warning: shadowing outer local variable - uffff

Here's the entire ruby script:

#!/usr/bin/ruby -w
require 'hjson'

Yes, my script turns on warnings. Still, it seems like a warning worth heeding.

Here are some specs:

Operating system Ubuntu Linux 16.04.1
Kernel and CPU Linux 4.4.0-78-generic on x86_64
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

Please let me know if there is other information that would help.

hjson-rb produces deprecation warning on Ruby 2.4 related to usage of Fixnum

Ruby 2.4 deprecated Fixnum and Bignum in favor of Integer. It seems that hjson-rb needs to replace references to Fixnum with a reference to Integer. After simple replacement of the Fixnum string the library works without warnings and parses the hjson files correctly (it passes all tests as well), but I'm not sure about backward compatibility.

Example:

$ ruby Compiler.rb colors.hjson -o colors.dat
/home/antek/.gem/ruby/2.4.0/gems/hjson-0.1.0/lib/hjson/ast/parser.rb:56: warning: constant ::Fixnum is deprecated

My Ruby version:

$ ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

Related links:

  1. https://bugs.ruby-lang.org/issues/12005
  2. http://blog.bigbinary.com/2016/11/18/ruby-2-4-unifies-fixnum-and-bignum-into-integer.html

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.