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
617 618 619 |
# File 'lib/tree_haver/backends/psych.rb', line 617 def column @column end |
#row ⇒ Object
Returns the value of attribute row
617 618 619 |
# File 'lib/tree_haver/backends/psych.rb', line 617 def row @row end |
Instance Method Details
#[](key) ⇒ Integer?
Hash-like access
622 623 624 625 626 627 |
# File 'lib/tree_haver/backends/psych.rb', line 622 def [](key) case key when :row, "row" then row when :column, "column" then column end end |
#inspect ⇒ String
640 641 642 |
# File 'lib/tree_haver/backends/psych.rb', line 640 def inspect "#<TreeHaver::Backends::Psych::Point row=#{row} column=#{column}>" end |
#to_h ⇒ Hash
630 631 632 |
# File 'lib/tree_haver/backends/psych.rb', line 630 def to_h {row: row, column: column} end |
#to_s ⇒ String
635 636 637 |
# File 'lib/tree_haver/backends/psych.rb', line 635 def to_s "(#{row}, #{column})" end |