repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/heredoc_wo_indent_spec.rb | spec/method/raw_scanner/heredoc_wo_indent_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > heredoc (wo indent)" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like "Heredoc (wo indent)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/double_quote_str_w_interpolation_spec.rb | spec/method/raw_scanner/double_quote_str_w_interpolation_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > double quote strings (w interpolation)" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like "Double quote strings (w interpolation)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/block_comment_spec.rb | spec/method/raw_scanner/block_comment_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > block comment (=begin ... =end)" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like "Block comment (=begin ... =end)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/heredoc_w_indent_spec.rb | spec/method/raw_scanner/heredoc_w_indent_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > heredoc (w indent)" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like "Heredoc (w indent)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/slash_operator_spec.rb | spec/method/raw_scanner/slash_operator_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Method's raw scanner > slash operator" do
extend Sourcify::Method::Parser::RawScanner::Spec::GenericSupport
behaves_like 'Slash operator'
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/method/raw_scanner/spec_helper.rb | spec/method/raw_scanner/spec_helper.rb | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../raw_scanner/shared_specs', __FILE__)
module Sourcify::Method::Parser::RawScanner
SCANNER = self
class << self
attr_reader :tokens, :counter
end
module Spec
module GenericSupport
def self.extended(bas... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_method_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_method_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested method)" do
should 'handle simple' do
(
lambda do
def aa; x = 1; end
end
).should.be having_source(%Q\
proc do
def aa; x = 1; end
end
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_within_pry_spec.rb | spec/proc/to_source_within_pry_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source within PRY" do
class << self
def pry_eval(string)
pry_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| normalize_code(found) == normalize_code(expected) }
end
end
should... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_specified_body_matcher_and_many_matches_spec.rb | spec/proc/to_source_from_multi_blocks_w_specified_body_matcher_and_many_matches_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified {:attached_to => ...} & single match' do
matcher = lambda {|code| code =~ /^(.*\W|)def\W/ }
if has_parsetree?
should 'handle no nesting on same line' do
b1 = lambda {|a| @x1+1 }; b2 = lambda... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/created_on_the_fly_proc_spec.rb | spec/proc/created_on_the_fly_proc_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Created on the fly proc" do
unless has_parsetree?
klass = Class.new do
def test(&block); block ; end
def blah; 1+2; end
end
describe 'Blah#to_proc raising Sourcify::CannotHandleCreatedOnTheFlyProcError' do
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_sexp_within_pry_spec.rb | spec/proc/to_sexp_within_pry_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_sexp within PRY" do
class << self
def pry_eval(string)
pry_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| found == expected }
end
end
should 'handle non var' do
expected ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_wo_nesting_complication_spec.rb | spec/proc/to_source_from_do_end_block_wo_nesting_complication_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (wo nesting complication)" do
expected = 'proc { @x%s }'
should 'handle watever(..) do ... end' do
(
watever(:a, :b, {:c => 1}) do @x1 end
).should.be having_source(expected%1)
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_many_matches_spec.rb | spec/proc/to_source_from_multi_blocks_w_many_matches_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source from multi blocks w many matches' do
if has_parsetree?
should "handle w no nesting on same line" do
b1 = lambda {|a| @x1+1 }; b2 = lambda { @x1+2 }; b3 = lambda { @x1+3 }
b2.should.be having_source('... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_if_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_if_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested if)" do
should 'handle simple block' do
(
lambda do
if @x1 then @x1 = 1 end
end
).should.be having_source(%Q\
proc do
if @x1 then @x1 = 1 end
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/encoding_spec.rb | spec/proc/encoding_spec.rb | # -*- coding: utf-8 -*-
#
# NOTE: The examples in this file are adapted from the original pull
# request submitted by tomykaira @ https://github.com/ngty/sourcify/pull/19.
#
require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Encoding" do
next unless Sourcify::IS_19x
should "handl... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_specified_body_matcher_and_no_match_spec.rb | spec/proc/to_source_from_multi_blocks_w_specified_body_matcher_and_no_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified body matcher & no match' do
matcher = lambda {|code| code =~ /^(.*\W|)def\W/ }
if has_parsetree?
should 'handle no nesting on same line' do
b1 = lambda do |a| @x1+1 end; b2 = lambda do @x1+2... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_braced_block_w_nested_hash_spec.rb | spec/proc/to_source_from_braced_block_w_nested_hash_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from { ... } block (w nested hash)" do
should 'handle simple' do
(
lambda {
{:a => 1, :b => 2}
}
).should.be having_source(%Q\
proc do
{:a => 1, :b => 2}
end
\)
e... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_unless_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_unless_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested unless)" do
should 'handle simple block' do
(
lambda do
unless @x1 then @x1 = 1 end
end
).should.be having_source(%Q\
proc do
unless @x1 then ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_sexp_within_irb_spec.rb | spec/proc/to_sexp_within_irb_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_sexp within IRB" do
class << self
def irb_eval(string)
irb_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| found == expected }
end
end
should 'handle non var' do
expected ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_sexp_variables_spec.rb | spec/proc/to_sexp_variables_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_sexp (variables)" do
should 'handle non var' do
expected = s(:iter, s(:call, nil, :proc, s(:arglist)), nil, s(:call, nil, :x, s(:arglist)))
lambda { x }.should.be having_sexp(expected)
end
should 'handle local ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_do_end_block_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_do_end_block_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested do ... end block)" do
should 'handle simple' do
(
lambda do
lambda do @x1 = 1 end
end
).should.be having_source(%Q\
proc do
lambda { @x1 = 1 }... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/others_spec.rb | spec/proc/others_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Misc" do
should 'handle accessing #to_sexp after #to_source' do
(s_proc = lambda { :test }).to_source
s_proc.should.be having_sexp(s(:iter, s(:call, nil, :proc, s(:arglist)), nil, s(:lit, :test)))
end
should 'handle ac... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_single_match_spec.rb | spec/proc/to_source_from_multi_blocks_w_single_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source from multi blocks w single match' do
should 'skip non-matching w no nesting on same line' do
b1 = lambda do |a| @x1 end; b2 = lambda do @x1 end
b2.should.be having_source('proc { @x1 }')
end
should 'skip... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_class_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_class_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested class)" do
should 'handle simple' do
(
lambda do
class AA
def aa
@x1 = 1
end
end
end
).should.be having_source(%Q\
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_magic_line_var_spec.rb | spec/proc/to_source_magic_line_var_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source (magic var __LINE__)" do
should 'handle single standalone' do
lambda { __LINE__ }.should.be having_source(%(proc { #{__LINE__} }))
end
should 'handle multiple standalones' do
lambda {
[
__L... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_specified_attached_to_spec.rb | spec/proc/to_source_from_multi_blocks_w_specified_attached_to_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified {:attached_to => ...}' do
unless has_parsetree?
err1 = Sourcify::MultipleMatchingProcsPerLineError
err2 = Sourcify::NoMatchingProcError
describe '>> w :attached_to as regexp' do
should... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_case_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_case_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested case)" do
should 'handle simple' do
(
lambda do
case @x1 when true then false end
end
).should.be having_source(%Q\
proc do
case @x1 when true... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_module_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_module_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested module)" do
should 'handle simple' do
(
lambda do
module AA
def aa
@x1 = 1
end
end
end
).should.be having_source(%Q\... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_braced_block_wo_nesting_complication_spec.rb | spec/proc/to_source_from_braced_block_wo_nesting_complication_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from { ... } block (wo nesting complication)" do
expected = 'proc { @x%s }'
should 'handle watever(..) { ... }' do
(
watever(:a, :b, {:c => 1}) { @x1 }
).should.be having_source(expected%1)
end
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_w_specified_strip_enclosure_spec.rb | spec/proc/to_source_w_specified_strip_enclosure_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified {:strip_enclosure => ...}' do
describe '>> w true' do
options = {:strip_enclosure => true}
should 'strip enclosing proc wo arg' do
lambda { a+b }.should.be having_source('a+b', options)
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/19x_extras.rb | spec/proc/19x_extras.rb | shared 'Proc#to_source from { ... } block (1.9.*)' do
should 'handle simple (w label keys)' do
(
lambda {
{a: 1, b: 2}
}
).should.be having_source(%Q\
proc do
{:a => 1, :b => 2}
end
\)
end
should 'handle nested (w label keys)' do
(
lambda {
{... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_do_end_blocks_w_single_match_spec.rb | spec/proc/to_source_from_multi_do_end_blocks_w_single_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source from multi blocks w single match' do
expected = 'proc { @x%s }'
should 'skip non-matching (all do...end blocks)' do
(
b1 = lambda do |a| @x1 end; b2 = lambda do @x1 end; b2
).should.be having_source(... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_sexp_w_specified_strip_enclosure_spec.rb | spec/proc/to_sexp_w_specified_strip_enclosure_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_sexp w specified {:strip_enclosure => ...}' do
describe '>> w true' do
options = {:strip_enclosure => true}
should 'strip enclosing proc wo arg' do
lambda { a+b }.should.be having_sexp(
s(:call,
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_within_irb_spec.rb | spec/proc/to_source_within_irb_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source within IRB" do
class << self
def irb_eval(string)
irb_exec(string)[-1]
end
def equal_to(expected)
lambda {|found| normalize_code(found) == normalize_code(expected) }
end
end
should... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_sexp_from_multi_blocks_w_specified_attached_to_spec.rb | spec/proc/to_sexp_from_multi_blocks_w_specified_attached_to_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_sexp w specified {:attached_to => ...}' do
# NOTE: We just want enough specs to show that handling of :attached_to
# works for Proc#to_sexp as well.
options = {:attached_to => /^.*?(\W|)watever(\W)/}
should 'handle ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_specified_attached_to_and_single_match_spec.rb | spec/proc/to_source_from_multi_blocks_w_specified_attached_to_and_single_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified {:attached_to => ...} & single match' do
options = {:attached_to => :watever}
should 'handle no nesting on same line' do
b1 = lambda {|a| @x1+1 }; b2 = watever { @x1+2 }; b3 = lambda { @x1+3 }
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_begin_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_begin_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested begin)" do
should 'handle simple' do
(
lambda do
begin @x1 = 1 end
end
).should.be having_source(%Q\
proc do
begin @x1 = 1 end
end
\... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_specified_attached_to_and_many_matches_spec.rb | spec/proc/to_source_from_multi_blocks_w_specified_attached_to_and_many_matches_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified {:attached_to => ...} & single match' do
options = {:attached_to => :lambda}
if has_parsetree?
should 'handle no nesting on same line' do
b1 = lambda {|a| @x1+1 }; b2 = lambda { @x1+2 }; b3 ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_for_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_for_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested for block)" do
should 'handle w do' do
(
lambda do
for x1 in [1,2] do x1 end
end
).should.be having_source(%Q\
proc do
for x1 in [1,2] do x1 e... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_until_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_until_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested until block)" do
should 'handle w do' do
(
lambda do
until true do @x1 = 1 end
end
).should.be having_source(%Q\
proc do
until true do @x1 = 1... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_braced_block_w_nested_braced_block_spec.rb | spec/proc/to_source_from_braced_block_w_nested_braced_block_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from { ... } block (w nested { ... } block)" do
should 'handle simple' do
(
lambda {
lambda { @x1 = 1 }
}
).should.be having_source(%Q\
proc do
lambda { @x1 = 1 }
end
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_specified_ignore_nested_spec.rb | spec/proc/to_source_from_multi_blocks_w_specified_ignore_nested_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified {:ignore_nested => ...}' do
options = {:ignore_nested => true}
if has_parsetree?
should 'handle no nesting on same line' do
b1 = lambda {|a| @x1+1 }; b2 = lambda { @x1+2 }; b3 = lambda { @x1... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_specified_body_matcher_and_single_match_spec.rb | spec/proc/to_source_from_multi_blocks_w_specified_body_matcher_and_single_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified body matcher & single match' do
matcher = lambda {|code| code =~ /^(.*\W|)def\W/ }
should 'handle no nesting on same line' do
b1 = lambda {|a| @x1+1 }; b2 = lambda { @x1+2 }; b3 = lambda { def aa; ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_magic_file_var_spec.rb | spec/proc/to_source_magic_file_var_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source (magic var __FILE__)" do
should 'handle single standalone' do
lambda { __FILE__ }.should.be having_source(%(proc { "#{__FILE__}" }))
end
should 'handle multiple standalones' do
lambda {
[
_... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_variables_spec.rb | spec/proc/to_source_variables_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source (variables)" do
should 'handle non var' do
lambda { x }.should.be having_source(%|proc { x }|)
end
should 'handle local var' do
x = 'lx'
lambda { x }.should.be having_source(%|proc { x }|)
end
s... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_raw_source_w_specified_strip_enclosure_spec.rb | spec/proc/to_raw_source_w_specified_strip_enclosure_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_raw_source w specified {:strip_enclosure => ...}' do
describe '>> w true' do
options = {:strip_enclosure => true}
should 'strip enclosing proc wo arg' do
(
lambda do
a = 1
# i sho... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_raw_source_spec.rb | spec/proc/to_raw_source_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_raw_source" do
should 'retain comments' do
(
lambda do
a = 1
# i should stay !!
end
).should.be having_raw_source(%(
proc do
a = 1
# i should stay !!
end
)... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_multi_blocks_w_specified_attached_to_and_no_match_spec.rb | spec/proc/to_source_from_multi_blocks_w_specified_attached_to_and_no_match_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe 'Proc#to_source w specified {:attached_to => ...} & no match' do
options = {:attached_to => :forever}
if has_parsetree?
should 'handle no nesting on same line' do
b1 = lambda do |a| @x1+1 end; b2 = lambda do @x1+2 end;... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_while_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_while_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested while block)" do
should 'handle w do' do
(
lambda do
while true do @x1 = 1 end
end
).should.be having_source(%Q\
proc do
while true do @x1 = 1... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/spec_helper.rb | spec/proc/spec_helper.rb | require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'spec_helper')
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/to_source_from_do_end_block_w_nested_literal_keyword_spec.rb | spec/proc/to_source_from_do_end_block_w_nested_literal_keyword_spec.rb | require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
describe "Proc#to_source from do ... end block (w nested literal keyword)" do
# See http://redmine.ruby-lang.org/issues/show/3764
should 'handle :class' do
(
lambda do
x = :class
end
).should.be having_source('... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/double_quote_str_wo_interpolation_spec.rb | spec/proc/raw_scanner/double_quote_str_wo_interpolation_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > double quote strings (wo interpolation)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like "Double quote strings (wo interpolation)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/double_colons_spec.rb | spec/proc/raw_scanner/double_colons_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > double colons" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like "Double colons"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/per_line_comment_spec.rb | spec/proc/raw_scanner/per_line_comment_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > per line comment (# ...)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like "Per line comment (# ...)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/kw_block_start_alias2_spec.rb | spec/proc/raw_scanner/kw_block_start_alias2_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > keyword block start alias #2 (incrementing counter by 0..1)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::KwBlockStartSupport
behaves_like "Keyword block start alias #2 (incrementing counter by 0... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/single_quote_str_spec.rb | spec/proc/raw_scanner/single_quote_str_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > single quote strings (\', %q & %w)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like 'Single quote strings (\', %q & %w)'
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/kw_block_start_alias1_spec.rb | spec/proc/raw_scanner/kw_block_start_alias1_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > keyword block start alias #1 (incrementing counter by 1)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::KwBlockStartSupport
behaves_like "Keyword block start alias #1 (incrementing counter by 1)"
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/heredoc_wo_indent_spec.rb | spec/proc/raw_scanner/heredoc_wo_indent_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > heredoc (wo indent)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like "Heredoc (wo indent)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/double_quote_str_w_interpolation_spec.rb | spec/proc/raw_scanner/double_quote_str_w_interpolation_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > double quote strings (w interpolation)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like "Double quote strings (w interpolation)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/block_comment_spec.rb | spec/proc/raw_scanner/block_comment_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > block comment (=begin ... =end)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like "Block comment (=begin ... =end)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/heredoc_w_indent_spec.rb | spec/proc/raw_scanner/heredoc_w_indent_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > heredoc (w indent)" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like "Heredoc (w indent)"
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/slash_operator_spec.rb | spec/proc/raw_scanner/slash_operator_spec.rb | require File.expand_path('../spec_helper', __FILE__)
unless has_parsetree?
describe "Proc's raw scanner > slash operator" do
extend Sourcify::Proc::Parser::RawScanner::Spec::GenericSupport
behaves_like 'Slash operator'
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/proc/raw_scanner/spec_helper.rb | spec/proc/raw_scanner/spec_helper.rb | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../raw_scanner/shared_specs', __FILE__)
module Sourcify::Proc::Parser::RawScanner
SCANNER = self
class << self
attr_reader :tokens, :do_end_counter
end
module Spec
module GenericSupport
def self.extende... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/double_colons_shared_spec.rb | spec/raw_scanner/double_colons_shared_spec.rb | shared "Double colons" do
should "handle A::B as :const" do
process(" A::B ").should.include([:const, 'A::B'])
end
should "handle A::aa as :const" do
process(" A::aa ").should.include([:const, 'A::aa'])
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/per_line_comment_shared_spec.rb | spec/raw_scanner/per_line_comment_shared_spec.rb | shared "Per line comment (# ...)" do
should 'handle start of line' do
process(<<EOL
aa
# bb
cc
EOL
).should.include([:comment, '# bb'])
end
should 'handle middle of line' do
process(<<EOL
aa # bb
cc
EOL
).should.include([:comment, '# bb'])
end
should 'ignore within heredoc' do... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/double_quote_str_wo_interpolation_shared_spec.rb | spec/raw_scanner/double_quote_str_wo_interpolation_shared_spec.rb | shared 'Double quote strings (wo interpolation)' do
%w{~ ` ! @ # $ % ^ & * _ - + = | \\ ; : ' " , . ? /}.map{|w| [w,w] }.concat(
[%w{( )}, %w{[ ]}, %w({ }), %w{< >}]
).each do |q1,q2|
['Q', 'W', 'x', 'r', ''].each do |t|
should "handle %#{t}#{q1}...#{q2} (wo escape (single))" do
process(" xx... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/single_quote_str_shared_spec.rb | spec/raw_scanner/single_quote_str_shared_spec.rb | shared 'Single quote strings (\', %q & %w)' do
%w{~ ` ! @ # $ % ^ & * _ - + = \\ | ; : ' " , . ? /}.map{|w| [w,w] }.concat(
[%w{( )}, %w{[ ]}, %w({ }), %w{< >}]
).each do |q1,q2|
%w{q w}.each do |t|
should "handle %#{t}#{q1}...#{q2} (wo escape (single))" do
process(" xx %#{t}#{q1}hello#{q2} ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/heredoc_wo_indent_shared_spec.rb | spec/raw_scanner/heredoc_wo_indent_shared_spec.rb | shared "Heredoc (wo indent)" do
%w{X "X" 'X'}.each do |tag|
should "handle <<#{tag}\\n .. \\nX\\n" do
process(%Q(
s <<#{tag}
aa
X
)).should.include([:heredoc, "<<#{tag}\n aa \nX"])
end
should "not handle <<#{tag} \\n .. \\nX\\n" do
process(%Q(
s << #{ta... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/double_quote_str_w_interpolation_shared_spec.rb | spec/raw_scanner/double_quote_str_w_interpolation_shared_spec.rb | shared 'Double quote strings (w interpolation)' do
# NOTE: we skip %Q#...# cos %Q#..#{..}..# is invalid syntax.
%w{~ ` ! @ $ % ^ & * _ - + = | ; : ' " , . ? / \\}.map{|w| [w,w] }.concat(
[%w{( )}, %w{[ ]}, %w({ }), %w{< >}]
).each do |q1,q2|
['Q', 'W', 'x', 'r', ''].each do |t|
should "handle %#{t... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/slash_operator_shared_spec.rb | spec/raw_scanner/slash_operator_shared_spec.rb | shared "Slash operator" do
should 'handle w preceding variable' do
process(%Q(a / b)).should.include([:op, '/'])
end
should 'handle w preceding constant' do
process(%Q(A / b)).should.include([:op, '/'])
end
should 'handle w preceding symbol' do
process(%Q(:a / b)).should.include([:op, '/'])
e... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/shared_specs.rb | spec/raw_scanner/shared_specs.rb | Dir[File.expand_path('../*_shared_spec.rb', __FILE__)].each do |file|
require file
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/kw_block_start_alias1_shared_spec.rb | spec/raw_scanner/kw_block_start_alias1_shared_spec.rb | shared "Keyword block start alias #1 (incrementing counter by 1)" do
kw_block_start_alias1.each do |kw|
%w{_ x 1}.each do |c|
should "not increment counter with ... (#{kw}#{c} ...)" do
kw_block_start_counter(<<EOL
aa (#{kw}#{c} bb ... )
cc
EOL
).should.equal([0,0])
end
end
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/heredoc_w_indent_shared_spec.rb | spec/raw_scanner/heredoc_w_indent_shared_spec.rb | shared "Heredoc (w indent)" do
%w{X "X" 'X'}.each do |tag|
should "handle <<-#{tag}\\n .. \\nX\\n" do
process(%Q(
s <<-#{tag}
aa
X
)).should.include([:heredoc, "<<-#{tag}\n aa \nX"])
end
should "handle <<-#{tag}\\n .. \\n X\\n" do
process(%Q(
s <<-#{tag... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/block_comment_shared_spec.rb | spec/raw_scanner/block_comment_shared_spec.rb | shared "Block comment (=begin ... =end)" do
should 'handle =begin\n ... =end\n' do
process(<<EOL
aa
=begin
bb
=end
cc
EOL
).should.include([:comment, "\n=begin\n bb \n=end"])
end
should 'handle =begin \n ... =end\n' do
process(<<EOL
aa
=begin
bb
=end
cc
EOL
).should.include([:... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/spec/raw_scanner/kw_block_start_alias2_shared_spec.rb | spec/raw_scanner/kw_block_start_alias2_shared_spec.rb | shared "Keyword block start alias #2 (incrementing counter by 0..1)" do
kw_block_start_alias2.each do |kw|
%w{_ x 1}.each do |c|
should "not increment counter with ... (#{kw}#{c} ...)" do
kw_block_start_counter(<<EOL
aa (#{kw}#{c} bb ... )
cc
EOL
).should.equal([0,0])
end
e... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify.rb | lib/sourcify.rb | require 'rubygems'
require 'ruby_parser'
require 'sexp_processor'
require 'ruby2ruby'
require 'file/tail'
begin
require 'parse_tree'
require 'parse_tree_extensions'
rescue LoadError
# ParseTree is now optional for all supported rubies :)
end
module Sourcify #:nodoc:
IS_19x = RUBY_VERSION.include?('1.9.')
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc.rb | lib/sourcify/proc.rb | module Sourcify
class MultipleMatchingProcsPerLineError < Exception; end
class NoMatchingProcError < Exception; end
class CannotHandleCreatedOnTheFlyProcError < Exception; end
module Proc
def self.included(base) #:nodoc:
base.class_eval do
Sourcify.require_rb('proc', 'methods')
incl... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/version.rb | lib/sourcify/version.rb | module Sourcify
VERSION = "0.6.0.rc4"
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/errors.rb | lib/sourcify/errors.rb | module Sourcify
class ParserInternalError < Exception; end
class CannotParseEvalCodeError < Exception; end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method.rb | lib/sourcify/method.rb | module Sourcify
class MultipleMatchingMethodsPerLineError < Exception; end
class NoMatchingMethodError < Exception; end
class CannotFindSourceLocationError < Exception; end
class PlatformNotSupportedError < Exception; end
IS_PLATFORM_SUPPORTED =
begin
[:source_location, :parameters].each{|meth| 1.... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/patches.rb | lib/sourcify/patches.rb | if RUBY_VERSION.include?('1.8.6')
unless 1.respond_to?(:pred)
class Integer
def pred
self - 1
end
end
end
unless :a.respond_to?(:to_proc)
class Symbol
def to_proc
Proc.new{|*args| args.shift.__send__(self, *args)}
end
end
end
end
unless binding.respond... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/methods.rb | lib/sourcify/method/methods.rb | %w{to_source to_sexp to_raw_source}.each do |file|
Sourcify.require_rb('method', 'methods', file)
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/parser.rb | lib/sourcify/method/parser.rb | %w{scanner source_code converter}.each do |file|
Sourcify.require_rb('method', 'parser', file)
end
module Sourcify
module Method
class Parser #:nodoc:all
class ProbablyDefinedByProc < Exception; end
def initialize(_meth)
@parameters, @name = _meth.parameters, _meth.name
@source_co... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/methods/to_sexp.rb | lib/sourcify/method/methods/to_sexp.rb | module Sourcify
module Method
module Methods #:nodoc:all
module ToSexp
def self.included(base)
base.class_eval do
Sourcify.require_rb('method', 'parser')
if IS_PLATFORM_SUPPORTED
def to_sexp(opts = {}, &body_matcher)
(@sourcified_par... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/methods/to_raw_source.rb | lib/sourcify/method/methods/to_raw_source.rb | module Sourcify
module Method
module Methods #:nodoc:all
module ToRawSource
def self.included(base)
base.class_eval do
Sourcify.require_rb('method', 'parser')
if IS_PLATFORM_SUPPORTED
def to_raw_source(opts = {}, &body_matcher)
(@sou... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/methods/to_source.rb | lib/sourcify/method/methods/to_source.rb | module Sourcify
module Method
module Methods #:nodoc:all
module ToSource
def self.included(base)
base.class_eval do
Sourcify.require_rb('method', 'parser')
if IS_PLATFORM_SUPPORTED
def to_source(opts = {}, &body_matcher)
(@sourcified... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/parser/raw_scanner.rb | lib/sourcify/method/parser/raw_scanner.rb |
# line 1 "/home/ty.archlinux/dev/ty/sourcify/lib/sourcify/method/parser/raw_scanner.rl"
Sourcify.require_rb('method', 'parser', 'raw_scanner_extensions')
module Sourcify
module Method
class Parser
module RawScanner #:nodoc:all
# line 129 "/home/ty.archlinux/dev/ty/sourcify/lib/sourcify/method/parser/raw... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | true |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/parser/converter.rb | lib/sourcify/method/parser/converter.rb | module Sourcify
module Method
class Parser #:nodoc:all
Sourcify.require_rb('common', 'parser', 'converter')
Converter = Common::Parser::Converter
end
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/parser/scanner.rb | lib/sourcify/method/parser/scanner.rb | Sourcify.require_rb('method', 'parser', 'raw_scanner')
module Sourcify
module Method
class Parser #:nodoc:all
class Scanner
class << self
def process(source_code, opts, &matcher)
results = rscan(source_code.to_s, {
:start_pattern => scan_pattern_hint(opts[:attac... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/parser/source_code.rb | lib/sourcify/method/parser/source_code.rb | module Sourcify
module Method
class Parser #:nodoc:all
Sourcify.require_rb('common', 'parser', 'source_code')
SourceCode = Common::Parser::SourceCode
end
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/method/parser/raw_scanner_extensions.rb | lib/sourcify/method/parser/raw_scanner_extensions.rb | Sourcify.require_rb('common', 'parser', 'raw_scanner', 'extensions')
module Sourcify
module Method
class Parser
module RawScanner #:nodoc:all
module Extensions
include Common::Parser::RawScanner::Extensions
Counter = Common::Parser::RawScanner::Counter
def increment_... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/common/parser/converter.rb | lib/sourcify/common/parser/converter.rb | module Sourcify
module Common
class Parser #:nodoc:all
class Converter
class << self
RUBY_PARSER = RubyParser.new
RUBY_2_RUBY = Ruby2Ruby.new
def to_sexp(code, file = nil)
retried = false
begin
RUBY_PARSER.reset
(ret... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/common/parser/source_code.rb | lib/sourcify/common/parser/source_code.rb | module Sourcify
module Common
class Parser #:nodoc:all
class SourceCode < Struct.new(:file, :line)
def line
super.pred
end
def to_s
case file
when /\(irb\)/, /\(irb\#\d+\)/ then from_irb_to_s
when /\(pry\)/ then from_pry_to_s
else f... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/common/parser/raw_scanner/extensions.rb | lib/sourcify/common/parser/raw_scanner/extensions.rb | %w{heredoc comment dstring counter}.each do |f|
Sourcify.require_rb('common', 'parser', 'raw_scanner', f)
end
module Sourcify
module Common
class Parser
module RawScanner #:nodoc:all
module Extensions
class Escape < Exception; end
def process(data, opts={})
begin... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/common/parser/raw_scanner/heredoc.rb | lib/sourcify/common/parser/raw_scanner/heredoc.rb | module Sourcify
module Common
class Parser
module RawScanner #:nodoc:all
class Heredoc < Struct.new(:tag, :indented, :encoding)
def <<(content)
(@contents ||= []) << content
end
def to_s
@contents.join.force_encoding(encoding)
end
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/common/parser/raw_scanner/dstring.rb | lib/sourcify/common/parser/raw_scanner/dstring.rb | module Sourcify
module Common
class Parser
module RawScanner #:nodoc:all
class DString < Struct.new(:tag, :encoding)
# To suppress 'warning: Object#type is deprecated; use Object#class' when
# evaluating string
attr_reader :type
def <<(content)
(... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/common/parser/raw_scanner/comment.rb | lib/sourcify/common/parser/raw_scanner/comment.rb | module Sourcify
module Common
class Parser
module RawScanner #:nodoc:all
class Comment
def <<(content)
(@contents ||= []) << content
end
def to_s
@contents.join
end
def closed?
@contents[-1].split("\n")[-1].stri... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/common/parser/raw_scanner/counter.rb | lib/sourcify/common/parser/raw_scanner/counter.rb | module Sourcify
module Common
class Parser
module RawScanner #:nodoc:all
class Counter
attr_reader :counts
def initialize
@counts = [0,0]
end
def started?
@counts.any?(&:nonzero?)
end
def just_started?
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/methods.rb | lib/sourcify/proc/methods.rb | %w{source_location to_source to_sexp to_raw_source}.each do |file|
Sourcify.require_rb('proc', 'methods', file)
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/parser.rb | lib/sourcify/proc/parser.rb | %w{normalizer scanner source_code converter}.each do |file|
Sourcify.require_rb('proc', 'parser', file)
end
module Sourcify
module Proc
class Parser #:nodoc:all
def initialize(_proc)
@arity, @source_code = _proc.arity, SourceCode.new(*_proc.source_location(false))
raise CannotHandleCreat... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.