module T::Props::Private::Parse
Public Instance Methods
parse(source)
click to toggle source
# File lib/types/props/private/parser.rb, line 7 def parse(source) @current_ruby ||= require_parser(:CurrentRuby) @current_ruby.parse(source) end
s(type, *children)
click to toggle source
# File lib/types/props/private/parser.rb, line 12 def s(type, *children) @node ||= require_parser(:AST, :Node) @node.new(type, children) end
Private Instance Methods
require_parser(*constants)
click to toggle source
# File lib/types/props/private/parser.rb, line 17 def require_parser(*constants) # This is an optional dependency for sorbet-runtime in general, # but is required here require 'parser/current' # Hack to work around the static checker thinking the constant is # undefined cls = Kernel.const_get(:Parser, true) while (const = constants.shift) cls = cls.const_get(const, false) end cls end