Class: Knossos::Cell

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Cell

Returns a new instance of Cell.



6
7
8
9
10
11
12
13
14
# File 'lib/knossos/cell.rb', line 6

def initialize(args = {})
  args = defaults.merge(args)

  @row = args[:row]
  @column = args[:column]
  @contents = args[:contents]

  @links = []
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



3
4
5
# File 'lib/knossos/cell.rb', line 3

def column
  @column
end

#contentsObject

Returns the value of attribute contents.



4
5
6
# File 'lib/knossos/cell.rb', line 4

def contents
  @contents
end

Returns the value of attribute links.



3
4
5
# File 'lib/knossos/cell.rb', line 3

def links
  @links
end

#rowObject (readonly)

Returns the value of attribute row.



3
4
5
# File 'lib/knossos/cell.rb', line 3

def row
  @row
end

Instance Method Details



16
17
18
# File 'lib/knossos/cell.rb', line 16

def link_to(cell)
  @links << cell
end

#linked?(cell) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/knossos/cell.rb', line 20

def linked?(cell)
  @links.include? cell
end