Class: AsciiTree::Word
- Inherits:
-
Object
- Object
- AsciiTree::Word
- Defined in:
- lib/ascii_tree/word.rb
Instance Attribute Summary collapse
-
#end_coordinate ⇒ Object
readonly
Returns the value of attribute end_coordinate.
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
-
#start_coordinate ⇒ Object
readonly
Returns the value of attribute start_coordinate.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #include?(coordinate) ⇒ Boolean
-
#initialize(identity:, value:, start_coordinate:, end_coordinate:) ⇒ Word
constructor
A new instance of Word.
Constructor Details
#initialize(identity:, value:, start_coordinate:, end_coordinate:) ⇒ Word
Returns a new instance of Word.
5 6 7 8 9 10 |
# File 'lib/ascii_tree/word.rb', line 5 def initialize(identity:, value:, start_coordinate:, end_coordinate:) @identity = identity @value = value @start_coordinate = start_coordinate @end_coordinate = end_coordinate end |
Instance Attribute Details
#end_coordinate ⇒ Object (readonly)
Returns the value of attribute end_coordinate.
3 4 5 |
# File 'lib/ascii_tree/word.rb', line 3 def end_coordinate @end_coordinate end |
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
3 4 5 |
# File 'lib/ascii_tree/word.rb', line 3 def identity @identity end |
#start_coordinate ⇒ Object (readonly)
Returns the value of attribute start_coordinate.
3 4 5 |
# File 'lib/ascii_tree/word.rb', line 3 def start_coordinate @start_coordinate end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/ascii_tree/word.rb', line 3 def value @value end |
Instance Method Details
#==(other) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/ascii_tree/word.rb', line 12 def ==(other) identity == other.identity && value == other.value && start_coordinate == other.start_coordinate && end_coordinate == other.end_coordinate end |
#include?(coordinate) ⇒ Boolean
19 20 21 |
# File 'lib/ascii_tree/word.rb', line 19 def include?(coordinate) same_line?(coordinate.y) && inside?(coordinate.x) end |