Class: RspecTree::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rspec_tree/cli.rb

Overview

This class is used to define the CLI

Instance Method Summary collapse

Instance Method Details

#all(file) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/rspec_tree/cli.rb', line 11

def all(file)
  File.open(file, "r") do |f|
    visitor = RspecTree::Visitor.new
    Prism.parse(f.read).value.accept(visitor)
    RspecTree::Tree.new(visitor.root, :all).print
  end
end

#ctx(file) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/rspec_tree/cli.rb', line 20

def ctx(file)
  File.open(file, "r") do |f|
    visitor = RspecTree::Visitor.new
    Prism.parse(f.read).value.accept(visitor)
    RspecTree::Tree.new(visitor.root, :ctx).print
  end
end