Giter Site home page Giter Site logo

DSL has no methods about prism HOT 7 CLOSED

edwardloveall avatar edwardloveall commented on September 4, 2024
DSL has no methods

from prism.

Comments (7)

kddnewton avatar kddnewton commented on September 4, 2024

Which version of prism are you using? I get:

irb(main):007> (Prism::DSL.methods - Module.methods).length
=> 167

from prism.

marcoroth avatar marcoroth commented on September 4, 2024

I can reproduce the error on 0.30.0:

irb(main):001> require "prism"
=> true
irb(main):002> puts Prism::VERSION
0.30.0
irb(main):003>  (Prism::DSL.methods - Module.methods).length
=> 0

# ...

irb(main):029> Builder.new.build
(irb):10:in `initialize': undefined method `source' for an instance of Builder (NoMethodError)

    @default_source = source("[1]")
                      ^^^^^^
        from (irb):29:in `new'
        from (irb):29:in `<main>'
        from <internal:kernel>:187:in `loop'
        from /Users/marcoroth/.anyenv/envs/rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/irb-1.14.0/exe/irb:9:in `<top (required)>'
        from /Users/marcoroth/.anyenv/envs/rbenv/versions/3.3.0/bin/irb:25:in `load'
        from /Users/marcoroth/.anyenv/envs/rbenv/versions/3.3.0/bin/irb:25:in `<main>'

from prism.

edwardloveall avatar edwardloveall commented on September 4, 2024

Thanks for the quick response.

Which version of prism are you using?

0.30.0

from prism.

marcoroth avatar marcoroth commented on September 4, 2024

Looking at the lib/prism/dsl.rb file of my prism gem on version 0.30.0 it shows that it has the old version of the DSL code with the PascalCased methods. Maybe the 0.30.0 version of the gem was published without compiling the dsl.rb.erb file again?

Here's a snippet:

# ~/.anyenv/envs/rbenv/versions/3.3.4/lib/ruby/gems/3.3.0/gems/prism-0.30.0/lib/prism/dsl.rb

module Prism
  # ...

  module DSL
    private

    # Create a new Location object
    def Location(source = nil, start_offset = 0, length = 0)
      Location.new(source, start_offset, length) # steep:ignore
    end

    # Create a new AliasGlobalVariableNode node
    def AliasGlobalVariableNode(new_name, old_name, keyword_loc, source = nil, location = Location())
      AliasGlobalVariableNode.new(source, new_name, old_name, keyword_loc, location)
    end
  
  # ...
end

from prism.

kddnewton avatar kddnewton commented on September 4, 2024

Ahh shoot sorry that documentation reflects main, which hasn't been released yet. That'll be out soon.

from prism.

kddnewton avatar kddnewton commented on September 4, 2024

In the meantime you're welcome to point to main (to use the new APIs) or you can use the old APIs (the documentation that ships with the gem).

from prism.

edwardloveall avatar edwardloveall commented on September 4, 2024

Gotcha, thanks so much!

from prism.

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.