Class: UnicodePlot::IOContext
- Inherits:
-
Object
- Object
- UnicodePlot::IOContext
- Extended by:
- Forwardable
- Defined in:
- src/lib/unicode_plot/io_context.rb
Instance Method Summary collapse
-
#color? ⇒ Boolean
-
#initialize(io, color: :auto) ⇒ IOContext
constructor
A new instance of IOContext.
Constructor Details
#initialize(io, color: :auto) ⇒ IOContext
Returns a new instance of IOContext.
7 8 9 10 |
# File 'src/lib/unicode_plot/io_context.rb', line 7 def initialize(io, color: :auto) @io = io @color = check_color(color) end |
Instance Method Details
#color? ⇒ Boolean
14 15 16 17 18 19 20 21 |
# File 'src/lib/unicode_plot/io_context.rb', line 14 def color? case @color when :auto @io.respond_to?(:tty?) ? @io.tty? : false else @color end end |