Module: CooCoo::Drawing::Sixel

Defined in:
lib/coo-coo/drawing/sixel.rb

Defined Under Namespace

Classes: Streamer, Stringer

Class Method Summary collapse

Class Method Details

.from_array(a, width, height = nil) ⇒ Object



6
7
8
9
# File 'lib/coo-coo/drawing/sixel.rb', line 6

def self.from_array(a, width, height = nil)
  s = Stringer.new
  s.begin_sixel + s.from_array(a, width, height) + s.newline + s.finish_sixel
end

.to_string(&block) ⇒ Object



17
18
19
20
21
# File 'lib/coo-coo/drawing/sixel.rb', line 17

def self.to_string(&block)
  stream = StringIO.new
  Streamer.new(stream, &block)
  stream.string
end

.with_sixel(io = $stdout, &block) ⇒ Object



11
12
13
14
15
# File 'lib/coo-coo/drawing/sixel.rb', line 11

def self.with_sixel(io = $stdout, &block)
  Streamer.new(io) do |s|
    block.call(s)
  end
end