method_source icon indicating copy to clipboard operation
method_source copied to clipboard

return the sourcecode for a method

Results 31 method_source issues
Sort by recently updated
recently updated
newest added

### Issue Ran into this issue while writing parameterized tests that include an optional block argument. Simplest implementation of the problem: ```ruby require "method_source" a = [ {block: ->(e) {...

I have a Rails scope: ``` scope :positive_amount, -> { where("amount > 0") } ``` But when I do: ``` Transaction.method(:positive_amount).source.display ``` I get: ``` singleton_class.send(:define_method, name) do |*args| scope...

Related to #22 For blocks, `source_location` reports the line where the block opens as its line number. If the block is part of a multiline expression, this can be partway...

This way if you reload a file that defines a proc or a method the source updates. It also prevents `SourceNotFound` errors in case the proc or method definition moves...

I keep encountering this on multiple VMs on an aws `a1.xlarge` running the openSUSE Leap 15.1 ARM marketplace ami image. (I am running into this running GitLab) ``` /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/method_source-1.0.0/lib/method_source/code_helpers.rb:71: [BUG]...

truffleruby-head works fine but I was not able to add it to CI by myself

A few simple changes to allow this gem to be used when `RUBYOPT="--enable-frozen-string-literal"` is set in MRI 2.4+. However, it's worth noting that Bacon isn't frozen-string-literal friendly, so the test...

This is a test case to demonstrate what I mentioned in the title: ``` ruby #!/usr/bin/env ruby # test.rb class TestClass source = true [2] pry(main)> TestClass.new.test_m => "test_m here"...