Class: Bparity::Synthesis::StaticExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/bparity/synthesis.rb

Constant Summary collapse

SPEC_CALLS =
%i[describe context it specify].freeze
ASSERTIONS =
%i[eq eql equal raise_error assert assert_equal assert_raises].freeze
UNSUPPORTED =
Object.new.freeze

Instance Method Summary collapse

Instance Method Details

#extract_source(paths) ⇒ Object



84
85
86
87
88
89
90
91
# File 'lib/bparity/synthesis.rb', line 84

def extract_source(paths)
  Array(paths).flat_map do |path|
    result = Prism.parse_file(path)
    raise Error, "Cannot parse #{path}. Fix its Ruby syntax and try again." unless result.success?

    source_facts(result.value, path)
  end
end

#extract_tests(paths) ⇒ Object



80
81
82
# File 'lib/bparity/synthesis.rb', line 80

def extract_tests(paths)
  Array(paths).flat_map { |path| extract_test_file(path) }
end