Class: Map
- Inherits:
-
Object
show all
- Defined in:
- lib/delve/generator/map.rb
Constant Summary
collapse
- @@default_width =
80
- @@default_height =
24
Instance Method Summary
collapse
Constructor Details
#initialize(width = nil, height = nil) ⇒ Map
Returns a new instance of Map.
6
7
8
9
|
# File 'lib/delve/generator/map.rb', line 6
def initialize(width=nil, height=nil)
@width = width || @@default_width
@height = height || @@default_height
end
|
Instance Method Details
#fill(value) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/delve/generator/map.rb', line 19
def fill(value)
map = Array.new
(0..@width-1).each do |x|
map << Array.new
(0..@height-1).each do
map[x] << value
end
end
map
end
|
#height ⇒ Object
15
16
17
|
# File 'lib/delve/generator/map.rb', line 15
def height
@height
end
|
#width ⇒ Object
11
12
13
|
# File 'lib/delve/generator/map.rb', line 11
def width
@width
end
|