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

Returns:

  • (Object)

    the current value of column



568
569
570
# File 'lib/tree_haver/backends/psych.rb', line 568

def column
  @column
end

#rowObject

Returns the value of attribute row

Returns:

  • (Object)

    the current value of 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

Parameters:

  • key (Symbol, String)

    :row or :column

Returns:

  • (Integer, nil)


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

#inspectString

Returns:

  • (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_hHash

Returns:

  • (Hash)


581
582
583
# File 'lib/tree_haver/backends/psych.rb', line 581

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

#to_sString

Returns:

  • (String)


586
587
588
# File 'lib/tree_haver/backends/psych.rb', line 586

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