question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scope `funk` doesn't match on Class methods - ruby

See original GitHub issue

I was hoping to try and fix this myself as a way to get familiar with how cursorless + tree sitter works but it might take me a bit to get up to speed. Here is the issue:

Given this code:

class Test
  class << self
    # `take funk` doesn't work
    def baz
    end
  end

  # `take funk` doesn't work
  def self.foo
    new.process
  end

  # `take funk` doesn't work
  def Test.bar
    new.process
  end

  # `take funk` works :D
  def process
    puts "process"
  end
end

Current use cases/scopes not covered:

  • "change funk" on a function defined self.
  • "change funk" on a function defined ClassName.
  • "change funk" on a function defined within class << self .... end block

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
Will-Sommerscommented, Jun 22, 2022

Heyo @richardmcmillen, interjecting here. I’m Will Sommers on the Talon slack and wheels on Handsfree Discord. Reach out if you have questions. I’m happy to answer there as well if it helps with a quicker feedback loop!

1reaction
Will-Sommerscommented, Jun 10, 2022

Heyo @richardmcmillen — thanks for adding this and apologies for missing it initially. I added another example in your code example and added a check list. When recording a test, it is best to use change or chuck instead of take since it is easier to see what happened in the test example. Please reach out in Slack if you have any questions or run into problems trying to implement this.

@pokey, no idea what to call whatever is inside class << self, thoughts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should you use scopes or class methods? - Justin Weiss
When your scope logic gets complicated, a class method feels like the right place to put it. Inside a class method, you can...
Read more >
ActiveRecord Rails 3 scope vs class method - Stack Overflow
From what I can gather, a scope is always expected to return a relation, whereas a class method doesn't necessarily have to. Is...
Read more >
Hunting Down the Scoop on ActiveRecord Scopes
We tried to call the order method on a falsy object (aka nil ). Obviously Ruby is unhappy, because it looks like Review.published(nil)...
Read more >
Upgrading Ruby on Rails
Upgrading Ruby on RailsThis guide provides steps to be followed when you upgrade your applications to a newer version of Ruby on Rails....
Read more >
README — Documentation for pundit (2.0.1) - RubyDoc.info
In your controller, Pundit will call the current_user method to retrieve what to ... class PostPolicy < ApplicationPolicy def update? user.admin? or not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found