Class: AlGraph::GraphOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/al_graph_base.rb

Overview

出力制御クラス

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGraphOutput

constructor



383
384
385
386
# File 'lib/al_graph_base.rb', line 383

def initialize()
  @mode = :STDOUT
  @out_buf = ""
end

Instance Attribute Details

#modeObject (readonly)

出力モード :STDOUT or :BUFFER



378
379
380
# File 'lib/al_graph_base.rb', line 378

def mode
  @mode
end

#out_bufObject (readonly)

出力バッファ



377
378
379
# File 'lib/al_graph_base.rb', line 377

def out_buf
  @out_buf
end

Instance Method Details

#printf(*arg) ⇒ Object

出力

Parameters:

  • arg

    出力データ



393
394
395
396
397
398
399
# File 'lib/al_graph_base.rb', line 393

def printf(*arg)
  if @mode == :STDOUT
    Kernel.printf(*arg)
  else
    @out_buf << Kernel.sprintf(*arg)
  end
end

#switch_mode(mode) ⇒ Object

出力先を切り替え

Parameters:

  • mode

    モード :STDOUT or :BUFFER



406
407
408
409
# File 'lib/al_graph_base.rb', line 406

def switch_mode( mode )
  @out_buf = ""
  @mode = mode
end