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
593 594 595 |
# File 'lib/tree_haver/backends/psych.rb', line 593 def column @column end |
#row ⇒ Object
Returns the value of attribute row
593 594 595 |
# File 'lib/tree_haver/backends/psych.rb', line 593 def row @row end |
Instance Method Details
#[](key) ⇒ Integer?
Hash-like access
598 599 600 601 602 603 |
# File 'lib/tree_haver/backends/psych.rb', line 598 def [](key) case key when :row, "row" then row when :column, "column" then column end end |
#inspect ⇒ String
616 617 618 |
# File 'lib/tree_haver/backends/psych.rb', line 616 def inspect "#<TreeHaver::Backends::Psych::Point row=#{row} column=#{column}>" end |
#to_h ⇒ Hash
606 607 608 |
# File 'lib/tree_haver/backends/psych.rb', line 606 def to_h {row: row, column: column} end |
#to_s ⇒ String
611 612 613 |
# File 'lib/tree_haver/backends/psych.rb', line 611 def to_s "(#{row}, #{column})" end |