Module: Toys::StandardMixins::Highline
- Includes:
- Mixin
- Defined in:
- toys-core/lib/toys/standard_mixins/highline.rb
Overview
Defined in the toys-core gem
A mixin that provides access to the capabilities of the highline gem.
This mixin requires the highline gem, version 2.0 or later. It will attempt to install the gem if it is not available.
You may make these methods available to your tool by including the following directive in your tool configuration:
include :highline
A HighLine object will then be available by calling the #highline
method. For information on using this object, see the
Highline documentation. Some of
the most common HighLine methods, such as say
, are also mixed into the
tool and can be called directly.
You can configure the HighLine object by passing options to the include
directive. For example:
include :highline, my_stdin, my_stdout
The arguments will be passed on to the HighLine constructor.
Constant Summary collapse
- KEY =
Context key for the highline object.
::Object.new.freeze
Instance Method Summary collapse
-
#agree(*args, &block) ⇒ Object
Calls HighLine#agree.
-
#ask(*args, &block) ⇒ Object
Calls HighLine#ask.
-
#choose(*args, &block) ⇒ Object
Calls HighLine#choose.
-
#color(*args) ⇒ Object
Calls HighLine#color.
-
#color_code(*args) ⇒ Object
Calls HighLine#color_code.
-
#highline ⇒ ::HighLine
A tool-wide HighLine instance.
-
#indent(*args, &block) ⇒ Object
Calls HighLine#indent.
-
#list(*args, &block) ⇒ Object
Calls HighLine#list.
-
#new_scope ⇒ Object
Calls HighLine#new_scope.
-
#newline ⇒ Object
Calls HighLine#newline.
-
#puts(*args) ⇒ Object
Calls HighLine#puts.
-
#say(*args, &block) ⇒ Object
Calls HighLine#say.
-
#uncolor(*args) ⇒ Object
Calls HighLine#uncolor.
Methods included from Mixin
Instance Method Details
#agree(*args, &block) ⇒ Object
Calls HighLine#agree
61 62 63 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 61 def agree(*args, &block) highline.agree(*args, &block) end |
#ask(*args, &block) ⇒ Object
Calls HighLine#ask
68 69 70 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 68 def ask(*args, &block) highline.ask(*args, &block) end |
#choose(*args, &block) ⇒ Object
Calls HighLine#choose
75 76 77 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 75 def choose(*args, &block) highline.choose(*args, &block) end |
#color(*args) ⇒ Object
Calls HighLine#color
117 118 119 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 117 def color(*args) highline.color(*args) end |
#color_code(*args) ⇒ Object
Calls HighLine#color_code
124 125 126 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 124 def color_code(*args) highline.color_code(*args) end |
#highline ⇒ ::HighLine
A tool-wide HighLine instance
54 55 56 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 54 def highline self[KEY] end |
#indent(*args, &block) ⇒ Object
Calls HighLine#indent
96 97 98 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 96 def indent(*args, &block) highline.indent(*args, &block) end |
#list(*args, &block) ⇒ Object
Calls HighLine#list
82 83 84 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 82 def list(*args, &block) highline.list(*args, &block) end |
#new_scope ⇒ Object
Calls HighLine#new_scope
138 139 140 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 138 def new_scope highline.new_scope end |
#newline ⇒ Object
Calls HighLine#newline
103 104 105 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 103 def newline highline.newline end |
#puts(*args) ⇒ Object
Calls HighLine#puts
110 111 112 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 110 def puts(*args) highline.puts(*args) end |
#say(*args, &block) ⇒ Object
Calls HighLine#say
89 90 91 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 89 def say(*args, &block) highline.say(*args, &block) end |
#uncolor(*args) ⇒ Object
Calls HighLine#uncolor
131 132 133 |
# File 'toys-core/lib/toys/standard_mixins/highline.rb', line 131 def uncolor(*args) highline.uncolor(*args) end |