Class: Clio::Buffer

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

Instance Method Summary collapse

Constructor Details

#initializeBuffer

Returns a new instance of Buffer.



18
19
20
# File 'lib/clio/buffer.rb', line 18

def initialize()
  @buffer = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(s, *a, &b) ⇒ Object



67
68
69
# File 'lib/clio/buffer.rb', line 67

def method_missing(s, *a, &b)
  @buffer.last.send(s, *a, &b)
end

Instance Method Details

#flowObject



58
59
# File 'lib/clio/buffer.rb', line 58

def flow
end

#line(fill = '-') ⇒ Object



35
36
37
# File 'lib/clio/buffer.rb', line 35

def line(fill='-')
  @buffer << Line.new(fill)
end

#list(*items) ⇒ Object



47
48
49
# File 'lib/clio/buffer.rb', line 47

def list(*items)
  @buffer << List.new(*items)
end

#newlineObject Also known as: nl



26
27
28
# File 'lib/clio/buffer.rb', line 26

def newline
  @buffer << "\n"
end


61
62
63
64
# File 'lib/clio/buffer.rb', line 61

def print
  Kernel.print(to_s)
  @buffer = []
end

#split(left, rite) ⇒ Object



39
40
41
# File 'lib/clio/buffer.rb', line 39

def split(left, rite)
  @buffer << Split.new(left, rite)
end

#stack(&block) ⇒ Object

def columns(text, number=2) end



54
55
56
# File 'lib/clio/buffer.rb', line 54

def stack(&block)
  
end

#string(str) ⇒ Object



31
32
33
# File 'lib/clio/buffer.rb', line 31

def string(str)
  @buffer << String.new(str)
end

#table(*rows_of_cells) ⇒ Object



43
44
45
# File 'lib/clio/buffer.rb', line 43

def table(*rows_of_cells)
  @buffer << Table.new(*rows_of_cells)
end

#to_sObject



22
23
24
# File 'lib/clio/buffer.rb', line 22

def to_s
  @buffer.collect{|e| e.to_s}.join('')
end