Module: RubyAnything
- Defined in:
- lib/ruby-anything.rb,
lib/ruby-anything/text.rb,
lib/ruby-anything/cursor.rb,
lib/ruby-anything/version.rb,
lib/ruby-anything/windows.rb,
lib/ruby-anything/filterable.rb,
lib/ruby-anything/base_window.rb,
lib/ruby-anything/windows/text_window.rb,
lib/ruby-anything/windows/items_window.rb,
lib/ruby-anything/windows/prompt_window.rb
Defined Under Namespace
Modules: Filterable Classes: BaseWindow, Cursor, ItemsWindow, PromptWindow, Text, TextWindow, Windows
Constant Summary collapse
- VERSION =
"0.0.5"
- ENHANSIVE_COLOR =
1
- PROMPT_COLOR =
2
Class Method Summary collapse
Class Method Details
.execute(ary) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ruby-anything.rb', line 9 def self.execute(ary) unless ary.respond_to? :to_a raise ArgumentError, "Invalid argument `#{ary}` for RubyAnything.execute. This argument must be Array" end unless ary.all? { |e| e.respond_to?(:to_s) } raise ArgumentError, "Invalid argument `#{ary}` for RubyAnything.execute. This argument's element must have `to_s` method" end isatty = STDOUT.isatty unless isatty stdout_old = STDOUT.dup STDOUT.reopen('/dev/tty') end Windows.anything ary.map(&:to_s) ensure unless isatty STDOUT.flush STDOUT.reopen stdout_old end end |