Class: Wayfarer::CLI::RoutePrinter
- Inherits:
-
Thor::Shell::Color
- Object
- Thor::Shell::Color
- Wayfarer::CLI::RoutePrinter
- Defined in:
- lib/wayfarer/cli/route_printer.rb
Constant Summary collapse
- INDENT =
" "
- REGULAR_SEGMENT =
"│ "
- JUNCTION_SEGMENT =
"├──"
- CORNER_SEGMENT =
"└──"
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#path_finder ⇒ Object
readonly
Returns the value of attribute path_finder.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url) ⇒ RoutePrinter
constructor
A new instance of RoutePrinter.
- #visit(route) ⇒ Object
Constructor Details
#initialize(url) ⇒ RoutePrinter
Returns a new instance of RoutePrinter.
17 18 19 20 21 |
# File 'lib/wayfarer/cli/route_printer.rb', line 17 def initialize(url) @url = url @path_finder = Wayfarer::Routing::PathFinder.new(url) super() end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'lib/wayfarer/cli/route_printer.rb', line 6 def output @output end |
#path_finder ⇒ Object (readonly)
Returns the value of attribute path_finder.
6 7 8 |
# File 'lib/wayfarer/cli/route_printer.rb', line 6 def path_finder @path_finder end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/wayfarer/cli/route_printer.rb', line 6 def url @url end |
Class Method Details
.print(route, url) ⇒ Object
13 14 15 |
# File 'lib/wayfarer/cli/route_printer.rb', line 13 def self.print(route, url) route.accept(new(url)) end |
Instance Method Details
#visit(route) ⇒ Object
23 24 25 26 27 |
# File 'lib/wayfarer/cli/route_printer.rb', line 23 def visit(route) route.accept(path_finder) unless route.parent puts format_route_output(route) true end |