class

Grid(T)

Inherits Enumerable < Iterable < Reference < Object

A simple grid class that can be indexed by Pnt.

Constructors

new(n : Int32, m : Int32, & : Int32, Int32 -> T)
Source
new(n : Int32, m : Int32, value : T)
Source
new(data : Array(Array(T)))
Source

Class methods

read(input : IO) : Grid(Char)
Source

Instance methods

[](i : Int32, j : Int32) : T
Source
[](pos : Pnt) : T
Source
[](i : Int32) : Array(T)

Access to a row

Source
[]=(i : Int32, j : Int32, value : T) : T
Source
[]=(pos : Pnt, value : T)
Source
each

Must yield this collection's elements to the block.

Source
each

Must return an Iterator over the elements in this collection.

Source
each_row
Source
each_row
Source
fill(value : T)
Source
find(value : T) : Pnt | Nil
Source
map

Returns an Array with the results of running the block against each element of the collection.

[1, 2, 3].map { |i| i * 10 } # => [10, 20, 30]
Source
to_s(io : IO)

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source