Class: Sod::Prefabs::Actions::Help

Inherits:
Action
  • Object
show all
Defined in:
lib/sod/prefabs/actions/help.rb

Overview

Displays help (usage) information.

Instance Attribute Summary

Attributes inherited from Action

#record

Instance Method Summary collapse

Methods inherited from Action

ancillary, default, description, inherited, #inspect, on, #to_proc

Constructor Details

#initialize(graph, presenter: Presenters::Node) ⇒ Help

Returns a new instance of Help.



14
15
16
17
18
# File 'lib/sod/prefabs/actions/help.rb', line 14

def initialize(graph, presenter: Presenters::Node, **)
  super(**)
  @graph = graph
  @presenter = presenter
end

Instance Method Details

#call(*lineage) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/sod/prefabs/actions/help.rb', line 20

def call *lineage
  if lineage.empty?
    io.puts presenter.new(graph).to_s
  else
    io.puts presenter.new(graph.get_child(*lineage)).to_s
  end
end