Class: DYI::Formatter::Base
- Inherits:
-
Object
- Object
- DYI::Formatter::Base
show all
- Defined in:
- lib/dyi/formatter/base.rb
Overview
Instance Method Summary
collapse
-
#initialize(canvas) ⇒ Base
constructor
-
#puts(io = $>) ⇒ Object
-
#save(file_name, options = {}) ⇒ Object
-
#string ⇒ Object
-
#write_canvas(canvas, io) ⇒ Object
-
#write_circle(shape, io) ⇒ Object
-
#write_ellipse(shape, io) ⇒ Object
-
#write_group(shape, io) ⇒ Object
-
#write_image(shape, io) ⇒ Object
-
#write_line(shape, io) ⇒ Object
-
#write_path(shape, io) ⇒ Object
-
#write_polygon(shape, io) ⇒ Object
-
#write_polyline(shape, io) ⇒ Object
-
#write_rectangle(shape, io) ⇒ Object
-
#write_text(shape, io) ⇒ Object
Constructor Details
#initialize(canvas) ⇒ Base
Returns a new instance of Base.
30
31
32
|
# File 'lib/dyi/formatter/base.rb', line 30
def initialize(canvas)
@canvas = canvas
end
|
Instance Method Details
#puts(io = $>) ⇒ Object
34
35
36
|
# File 'lib/dyi/formatter/base.rb', line 34
def puts(io=$>)
raise NotImplementedError
end
|
#save(file_name, options = {}) ⇒ Object
43
44
45
|
# File 'lib/dyi/formatter/base.rb', line 43
def save(file_name, options={})
open(file_name, "w") {|io| puts(io)}
end
|
#string ⇒ Object
38
39
40
41
|
# File 'lib/dyi/formatter/base.rb', line 38
def string
puts(sio = StringIO.new)
sio.string
end
|
#write_canvas(canvas, io) ⇒ Object
47
48
49
|
# File 'lib/dyi/formatter/base.rb', line 47
def write_canvas(canvas, io)
raise NotImplementedError
end
|
#write_circle(shape, io) ⇒ Object
55
56
57
|
# File 'lib/dyi/formatter/base.rb', line 55
def write_circle(shape, io)
raise NotImplementedError
end
|
#write_ellipse(shape, io) ⇒ Object
59
60
61
|
# File 'lib/dyi/formatter/base.rb', line 59
def write_ellipse(shape, io)
raise NotImplementedError
end
|
#write_group(shape, io) ⇒ Object
87
88
89
|
# File 'lib/dyi/formatter/base.rb', line 87
def write_group(shape, io)
raise NotImplementedError
end
|
#write_image(shape, io) ⇒ Object
80
81
|
# File 'lib/dyi/formatter/base.rb', line 80
def write_image(shape, io)
end
|
#write_line(shape, io) ⇒ Object
63
64
65
|
# File 'lib/dyi/formatter/base.rb', line 63
def write_line(shape, io)
raise NotImplementedError
end
|
#write_path(shape, io) ⇒ Object
75
76
77
|
# File 'lib/dyi/formatter/base.rb', line 75
def write_path(shape, io)
raise NotImplementedError
end
|
#write_polygon(shape, io) ⇒ Object
71
72
73
|
# File 'lib/dyi/formatter/base.rb', line 71
def write_polygon(shape, io)
raise NotImplementedError
end
|
#write_polyline(shape, io) ⇒ Object
67
68
69
|
# File 'lib/dyi/formatter/base.rb', line 67
def write_polyline(shape, io)
raise NotImplementedError
end
|
#write_rectangle(shape, io) ⇒ Object
51
52
53
|
# File 'lib/dyi/formatter/base.rb', line 51
def write_rectangle(shape, io)
raise NotImplementedError
end
|
#write_text(shape, io) ⇒ Object
83
84
85
|
# File 'lib/dyi/formatter/base.rb', line 83
def write_text(shape, io)
raise NotImplementedError
end
|