Method: Sourcify::Proc::Parser#initialize

Defined in:
lib/sourcify/lib/sourcify/proc/parser.rb

#initialize(_proc) ⇒ Parser

Returns a new instance of Parser.



9
10
11
12
13
14
# File 'lib/sourcify/lib/sourcify/proc/parser.rb', line 9

def initialize(_proc)
  @arity, @source_code = _proc.arity, SourceCode.new(*_proc.source_location(false))
  raise CannotHandleCreatedOnTheFlyProcError unless @source_code.file
  raise CannotParseEvalCodeError if @source_code.file == '(eval)'
  @binding = _proc.binding # this must come after the above check
end