Module: Peony::Shell
- Defined in:
- lib/peony/shell.rb,
lib/peony/shell/html.rb,
lib/peony/shell/basic.rb,
lib/peony/shell/color.rb
Defined Under Namespace
Constant Summary collapse
- SHELL_DELEGATED_METHODS =
[:ask, :error, :set_color, :yes?, :no?, :say, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width, :padding, :padding_to, :padding_up, :padding_down]
Instance Method Summary collapse
-
#shell ⇒ Object
Holds the shell for the given Thor instance.
-
#with_padding ⇒ Object
Yields the given block with padding.
Instance Method Details
#shell ⇒ Object
Holds the shell for the given Thor instance. If no shell is given, it gets a default shell from Thor::Base.shell.
16 17 18 19 20 21 22 23 24 |
# File 'lib/peony/shell.rb', line 16 def shell @shell ||= if ENV['PEONY_SHELL'] && ENV['PEONY_SHELL'].size > 0 Peony::Shell.const_get(ENV['PEONY_SHELL']).new elsif (RbConfig::CONFIG['host_os'] =~ /mswin|mingw/) && !(ENV['ANSICON']) Peony::Shell::Basic.new else Peony::Shell::Color.new end end |
#with_padding ⇒ Object
Yields the given block with padding.
36 37 38 39 40 41 |
# File 'lib/peony/shell.rb', line 36 def with_padding shell.padding_up yield ensure shell.padding_down end |