Module: RbsActiverecord::Parser

Defined in:
lib/rbs_activerecord/parser.rb,
lib/rbs_activerecord/parser/visitor.rb,
lib/rbs_activerecord/parser/evaluator.rb,
lib/rbs_activerecord/parser/include_expander.rb,
lib/rbs_activerecord/parser/include_expander/module.rb

Defined Under Namespace

Modules: Evaluator Classes: IncludeExpander, Visitor

Class Method Summary collapse

Class Method Details

.eval_node(node) ⇒ Object



23
24
25
# File 'lib/rbs_activerecord/parser.rb', line 23

def eval_node(node) #: untyped
  Evaluator.eval_node(node)
end

.parse(code) ⇒ Object



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

def parse(code) #: Hash[String, Array[Prism::CallNode]]
  result = Prism.parse(code)

  visitor = Visitor.new
  visitor.visit(result.value)
  visitor.decls
end

.parse_file(filename) ⇒ Object

: Hash[String, Array]



17
18
19
# File 'lib/rbs_activerecord/parser.rb', line 17

def parse_file(filename) #: Hash[String, Array[Prism::CallNode]]
  File.open(filename) { |f| parse(f.read) }
end