Class: Sod::Presenters::Node
- Inherits:
-
Object
- Object
- Sod::Presenters::Node
- Extended by:
- Forwardable
- Defined in:
- lib/sod/presenters/node.rb
Overview
Aids in rendering a node for display. :reek:TooManyInstanceVariables
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
Instance Method Summary collapse
-
#initialize(node, indent: 2, gap: 5, action_presenter: Presenters::Action) ⇒ Node
constructor
rubocop:todo Metrics/ParameterLists.
-
#to_s ⇒ Object
rubocop:enable Metrics/ParameterLists.
Constructor Details
#initialize(node, indent: 2, gap: 5, action_presenter: Presenters::Action) ⇒ Node
rubocop:todo Metrics/ParameterLists
24 25 26 27 28 29 30 31 |
# File 'lib/sod/presenters/node.rb', line 24 def initialize(node, indent: 2, gap: 5, action_presenter: Presenters::Action, **) super(**) @node = node @indent = indent @gap = gap @actions = node.actions.map { |action| action_presenter.new action.record } @all = actions + children.to_a end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
21 22 23 |
# File 'lib/sod/presenters/node.rb', line 21 def actions @actions end |
Instance Method Details
#to_s ⇒ Object
rubocop:enable Metrics/ParameterLists
34 35 36 37 38 |
# File 'lib/sod/presenters/node.rb', line 34 def to_s [, body, "", *usage, "", *colored_actions, "", *colored_commands].tap(&:compact!) .join("\n") .strip end |