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



593
594
595
# File 'lib/tree_haver/backends/psych.rb', line 593

def column
  @column
end

#rowObject

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

#inspectString



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

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

#to_hHash



606
607
608
# File 'lib/tree_haver/backends/psych.rb', line 606

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

#to_sString



611
612
613
# File 'lib/tree_haver/backends/psych.rb', line 611

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