Class: Vedeu::Models::Cell Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A Cell represents a single square of the terminal.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#colourNilClass|String (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (NilClass|String)


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

def colour
  @colour
end

#nameString|Symbol (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String|Symbol)


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

def name
  @name
end

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

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


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

def style
  @style
end

#valueNilClass|String (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (NilClass|String)


27
28
29
# File 'lib/vedeu/models/cell.rb', line 27

def value
  @value
end

Instance Method Details

#cell?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


30
31
32
# File 'lib/vedeu/models/cell.rb', line 30

def cell?
  true
end

#defaultsHash<Symbol => void> (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the default options/attributes for this class.

Returns:

  • (Hash<Symbol => void>)


80
81
82
83
84
85
86
87
88
# File 'lib/vedeu/models/cell.rb', line 80

def defaults
  {
    colour:   nil,
    name:     nil,
    style:    nil,
    value:    '',
    position: [1, 1],
  }
end

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

An object is equal when its values are the same.

Parameters:

Returns:

  • (Boolean)


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

def eql?(other)
  self.class == other.class && value == other.value &&
    position == other.position
end

#initialize(attributes = {}) ⇒ void Originally defined in module Repositories::Defaults

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

If a particular key is missing from the attributes parameter, then it is added with the respective value from #defaults.

Returns a new instance of the class including this module.

Parameters:

  • attributes (Hash) (defaults to: {})

#interfaceVedeu::Interfaces::Interface

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
47
# File 'lib/vedeu/models/cell.rb', line 45

def interface
  @interface ||= Vedeu.interfaces.by_name(name)
end

#positionVedeu::Geometry::Position

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def position
  Vedeu::Geometry::Position.coerce(@position)
end

#to_hashHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Hash)


55
56
57
58
59
60
61
62
# File 'lib/vedeu/models/cell.rb', line 55

def to_hash
  {
    colour:   colour.to_s,
    style:    style.to_s,
    value:    value.to_s,
    position: position.to_s,
  }
end

#to_html(_options = {}) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • _options (Hash) (defaults to: {})

    Ignored.

Returns:

  • (String)


66
67
68
# File 'lib/vedeu/models/cell.rb', line 66

def to_html(_options = {})
  ''
end

#to_sString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


71
72
73
# File 'lib/vedeu/models/cell.rb', line 71

def to_s
  value.to_s
end