Class: TreeHaver::Backends::Psych::Point
- Inherits:
-
Struct
- Object
- Struct
- TreeHaver::Backends::Psych::Point
- Defined in:
- lib/tree_haver/backends/psych.rb
Overview
Point struct for position information
Provides both method and hash-style access for compatibility.
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#row ⇒ Object
Returns the value of attribute row.
Instance Method Summary collapse
-
#[](key) ⇒ Integer?
Hash-like access.
- #inspect ⇒ String
- #to_h ⇒ Hash
- #to_s ⇒ String
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column
568 569 570 |
# File 'lib/tree_haver/backends/psych.rb', line 568 def column @column end |
#row ⇒ Object
Returns the value of attribute row
568 569 570 |
# File 'lib/tree_haver/backends/psych.rb', line 568 def row @row end |
Instance Method Details
#[](key) ⇒ Integer?
Hash-like access
573 574 575 576 577 578 |
# File 'lib/tree_haver/backends/psych.rb', line 573 def [](key) case key when :row, "row" then row when :column, "column" then column end end |
#inspect ⇒ String
591 592 593 |
# File 'lib/tree_haver/backends/psych.rb', line 591 def inspect "#<TreeHaver::Backends::Psych::Point row=#{row} column=#{column}>" end |
#to_h ⇒ Hash
581 582 583 |
# File 'lib/tree_haver/backends/psych.rb', line 581 def to_h {row: row, column: column} end |
#to_s ⇒ String
586 587 588 |
# File 'lib/tree_haver/backends/psych.rb', line 586 def to_s "(#{row}, #{column})" end |