Giter VIP home page Giter VIP logo

Comments (3)

flarnie avatar flarnie commented on May 19, 2024

On line 71 in import-js/ruby/import-js/importer.rb there are some method calls that are split onto separate lines. I assume my version of Ruby doesn't like that syntax - when I moved those methods all onto one line the error went away.

Edit: Support for newlines after method calls was added in Ruby 1.9 so my Vim installation must be using an old version of Ruby.

@trotzig Moving the placement of the dot makes this backwards compatible with old Ruby versions, like so:

70 string.
71 gsub(/::/, '/').
72 gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
73 gsub(/([a-z\d])([A-Z])/, '\1_\2').
74 tr('-', '_').
75 downcase

However, this Ruby styleguide recommends keeping the dot as the prefix rather than placing it at the end like this. I agree that the 1.9 syntax is more readable.

Options:

  • Update the README to expect users to have Ruby 1.9+ when using this plugin.
  • Move to the old syntax and support older versions of Ruby.

I'll submit pull requests for each option.

from import-js.

flarnie avatar flarnie commented on May 19, 2024

It looks like you can use the commands :echo has('ruby') and :ruby puts RUBY_VERSION to inspect whether Vim has Ruby set up and what version it's running.1

Mine is using '1.8.7' which is probably just the system default. I'm going to try and set it to one of the more recent versions.

from import-js.

flarnie avatar flarnie commented on May 19, 2024

Closed by 0cd733e

from import-js.

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.