Class: Howdoc::Step
- Inherits:
-
Object
- Object
- Howdoc::Step
- Defined in:
- lib/howdoc/step.rb
Overview
One numbered instruction in a guide: what happened, optionally an illustration of it, and a flag for the steps that mark the reader's arrival on a new page.
What happened is kept as the action and the values it was recorded with, not as a finished sentence, because the same step is told in every language the guide is published in.
Defined Under Namespace
Classes: Narrated
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#arrival ⇒ Object
Returns the value of attribute arrival.
-
#html ⇒ Object
Returns the value of attribute html.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#screenshot ⇒ Object
Returns the value of attribute screenshot.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#html_in(locale) ⇒ Object
Markup a caller supplied stands in every language: it was written by the application, which knew what it was doing.
-
#initialize(number:, action: nil, payload: {}, html: nil, screenshot: nil, arrival: false) ⇒ Step
constructor
A new instance of Step.
- #narrate(edition) ⇒ Object
Constructor Details
#initialize(number:, action: nil, payload: {}, html: nil, screenshot: nil, arrival: false) ⇒ Step
Returns a new instance of Step.
24 25 26 27 28 29 30 31 |
# File 'lib/howdoc/step.rb', line 24 def initialize(number:, action: nil, payload: {}, html: nil, screenshot: nil, arrival: false) @number = number @action = action @payload = payload @html = html @screenshot = screenshot @arrival = arrival end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
21 22 23 |
# File 'lib/howdoc/step.rb', line 21 def action @action end |
#arrival ⇒ Object
Returns the value of attribute arrival.
22 23 24 |
# File 'lib/howdoc/step.rb', line 22 def arrival @arrival end |
#html ⇒ Object
Returns the value of attribute html.
22 23 24 |
# File 'lib/howdoc/step.rb', line 22 def html @html end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
21 22 23 |
# File 'lib/howdoc/step.rb', line 21 def number @number end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
21 22 23 |
# File 'lib/howdoc/step.rb', line 21 def payload @payload end |
#screenshot ⇒ Object
Returns the value of attribute screenshot.
22 23 24 |
# File 'lib/howdoc/step.rb', line 22 def screenshot @screenshot end |
Instance Method Details
#empty? ⇒ Boolean
33 34 35 |
# File 'lib/howdoc/step.rb', line 33 def empty? html.nil? && action.nil? && screenshot.nil? end |
#html_in(locale) ⇒ Object
Markup a caller supplied stands in every language: it was written by the application, which knew what it was doing.
39 40 41 42 43 44 |
# File 'lib/howdoc/step.rb', line 39 def html_in(locale) return html unless html.nil? return nil if action.nil? Narrator.call(action, locale:, **payload) end |