Class: Vedeu::Cell

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

Overview

A Cell represents a single square of the terminal.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Vedeu::Cell

Returns a new instance of Vedeu::Cell.

Parameters:

  • attributes (Hash<Symbol => Array<Symbol|String>, Fixnum, String, Symbol]) (defaults to: {})

    ttributes [Hash<Symbol => Array<Symbol|String>, Fixnum, String, Symbol]

Options Hash (attributes):

  • colour (NilClass|String)
  • style (NilClass|Array<Symbol|String>|Symbol|String)
  • value (NilClass|String)
  • x (NilClass|Fixnum)
  • y (NilClass|Fixnum)


36
37
38
39
40
41
42
# File 'lib/vedeu/models/cell.rb', line 36

def initialize(attributes = {})
  @colour = attributes[:colour]
  @style  = attributes[:style]
  @value  = attributes[:value]
  @x      = attributes[:x]
  @y      = attributes[:y]
end

Instance Attribute Details

#colourNilClass|String (readonly)

Returns:

  • (NilClass|String)


8
9
10
# File 'lib/vedeu/models/cell.rb', line 8

def colour
  @colour
end

#styleNilClass|Array<Symbol|String>|Symbol|String (readonly)

Returns:

  • (NilClass|Array<Symbol|String>|Symbol|String)


12
13
14
# File 'lib/vedeu/models/cell.rb', line 12

def style
  @style
end

#valueNilClass|String (readonly)

Returns:

  • (NilClass|String)


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

def value
  @value
end

#xNilClass|Fixnum (readonly)

Returns:

  • (NilClass|Fixnum)


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

def x
  @x
end

#yNilClass|Fixnum (readonly)

Returns:

  • (NilClass|Fixnum)


24
25
26
# File 'lib/vedeu/models/cell.rb', line 24

def y
  @y
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

An object is equal when its values are the same.

Parameters:

Returns:

  • (Boolean)


48
49
50
51
52
# File 'lib/vedeu/models/cell.rb', line 48

def eql?(other)
  self.class == other.class && colour == other.colour &&
    style == other.style && value == other.value && x == other.x &&
    y == other.y
end