module BBS::Flow::Steps
The steps of a Flow that ask the caller and act on the answer (see Flow::Steps for the rest).
The steps of a Flow. Each one is a small object with run(runner), which does its part on the BBS::FlowRunner and returns nil to go on, :halt to end the flow, or :exit_menu to leave the innermost menu.
Constants
- App
-
A windowed
BBS::Application. - Ask
-
A question whose answer goes into the context under
name. - Banner
-
A boxed banner of
textin the colour ofstyle. - BigBanner
-
textin large FIGlet letters offontin the colour ofstyle. - Call
-
A block called with the context and the runner.
- Confirm
-
A yes/no question. With
stepsthey run on yes and the flow goes on either way; without, the flow goes on only on yes. -
An address the
:emailvalidator accepts: something, an @, and a domain with a dot. - EXIT_MENU
-
The one
ExitMenustep. - Gate
-
A check of the context;
deniedand the end of the flow when it fails. - Menu
-
A numbered menu of
options(pairs of label and steps). - Pause
-
message, then a wait ofseconds. - Persist
-
Saves the context values of
fieldstostorein the sessionโs row. - Say
-
An indented paragraph with a blank line around it.
- Screen
-
Renders the ERB screen
namewith the context andvars. - Text
-
One indented line:
content, or whatblockreturns for the context.
Public Class Methods
Source
# File lib/bbs/flow/questions.rb, line 128 def self.transform(value, transform) case transform when :upcase, :downcase then value.public_send(transform) when Proc then transform.call(value) else value end end
value after transform: :upcase, :downcase, a Proc, or nil for none.
Source
# File lib/bbs/flow/questions.rb, line 138 def self.valid?(value, validate) case validate when :email then value.match?(EMAIL) when :non_empty then !value.empty? when Proc, Method then validate.call(value) ? true : false else true end end
Whether value passes validate: :email, :non_empty, a Proc or Method, or nil for anything.