Class: CooCoo::Drawing::Sixel::Streamer

Inherits:
Object
  • Object
show all
Defined in:
lib/coo-coo/drawing/sixel.rb

Instance Method Summary collapse

Constructor Details

#initialize(io = $stdout, stringer = Stringer.new, &block) ⇒ Streamer



24
25
26
27
28
# File 'lib/coo-coo/drawing/sixel.rb', line 24

def initialize(io = $stdout, stringer = Stringer.new, &block)
  @io = io
  @stringer = stringer
  with_sixel(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(mid, *args, &block) ⇒ Object



30
31
32
# File 'lib/coo-coo/drawing/sixel.rb', line 30

def method_missing(mid, *args, &block)
  @io.write(@stringer.send(mid, *args, &block))
end

Instance Method Details

#with_sixel(&block) ⇒ Object



34
35
36
37
38
39
# File 'lib/coo-coo/drawing/sixel.rb', line 34

def with_sixel(&block)
  begin_sixel
  block.call(self)
ensure
  finish_sixel
end