Class: TreeHaver::Backends::Psych::Point

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#columnObject

Returns the value of attribute column



617
618
619
# File 'lib/tree_haver/backends/psych.rb', line 617

def column
  @column
end

#rowObject

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

#inspectString



640
641
642
# File 'lib/tree_haver/backends/psych.rb', line 640

def inspect
  "#<TreeHaver::Backends::Psych::Point row=#{row} column=#{column}>"
end

#to_hHash



630
631
632
# File 'lib/tree_haver/backends/psych.rb', line 630

def to_h
  {row: row, column: column}
end

#to_sString



635
636
637
# File 'lib/tree_haver/backends/psych.rb', line 635

def to_s
  "(#{row}, #{column})"
end