Class: Vedeu::Models::Cell Private
- Inherits:
-
Object
- Object
- Vedeu::Models::Cell
- 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
- #colour ⇒ NilClass|String readonly private
- #name ⇒ String|Symbol readonly private
- #style ⇒ NilClass|Array<Symbol|String>|Symbol|String readonly private
- #value ⇒ NilClass|String readonly private
Instance Method Summary collapse
- #cell? ⇒ Boolean private
-
#defaults ⇒ Hash<Symbol => void>
private
private
Returns the default options/attributes for this class.
-
#eql?(other) ⇒ Boolean
(also: #==)
private
An object is equal when its values are the same.
-
#initialize(attributes = {}) ⇒ Vedeu::Models::Cell
constructor
private
Returns a new instance of Vedeu::Models::Cell.
- #interface ⇒ Vedeu::Interfaces::Interface private
- #position ⇒ Vedeu::Geometry::Position private
- #to_hash ⇒ Hash private
- #to_html(_options = {}) ⇒ String private
- #to_s ⇒ String private
Constructor Details
#initialize(attributes = {}) ⇒ Vedeu::Models::Cell
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.
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 Vedeu::Models::Cell.
42 43 44 45 46 |
# File 'lib/vedeu/models/cell.rb', line 42 def initialize(attributes = {}) defaults.merge!(attributes).each do |key, value| instance_variable_set("@#{key}", value || defaults.fetch(key)) end end |
Instance Attribute Details
#colour ⇒ NilClass|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.
13 14 15 |
# File 'lib/vedeu/models/cell.rb', line 13 def colour @colour end |
#name ⇒ String|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.
17 18 19 |
# File 'lib/vedeu/models/cell.rb', line 17 def name @name end |
#style ⇒ NilClass|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.
21 22 23 |
# File 'lib/vedeu/models/cell.rb', line 21 def style @style end |
#value ⇒ NilClass|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.
25 26 27 |
# File 'lib/vedeu/models/cell.rb', line 25 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.
49 50 51 |
# File 'lib/vedeu/models/cell.rb', line 49 def cell? true end |
#defaults ⇒ Hash<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.
99 100 101 102 103 104 105 106 107 |
# File 'lib/vedeu/models/cell.rb', line 99 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.
57 58 59 60 |
# File 'lib/vedeu/models/cell.rb', line 57 def eql?(other) self.class == other.class && value == other.value && position == other.position end |
#interface ⇒ Vedeu::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.
64 65 66 |
# File 'lib/vedeu/models/cell.rb', line 64 def interface @interface ||= Vedeu.interfaces.by_name(name) end |
#position ⇒ Vedeu::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.
69 70 71 |
# File 'lib/vedeu/models/cell.rb', line 69 def position Vedeu::Geometry::Position.coerce(@position) end |
#to_hash ⇒ Hash
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.
74 75 76 77 78 79 80 81 |
# File 'lib/vedeu/models/cell.rb', line 74 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.
85 86 87 |
# File 'lib/vedeu/models/cell.rb', line 85 def to_html( = {}) '' end |
#to_s ⇒ 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.
90 91 92 |
# File 'lib/vedeu/models/cell.rb', line 90 def to_s value.to_s end |