Class: Ast::Merge::AstNode::Point
- Inherits:
-
Struct
- Object
- Struct
- Ast::Merge::AstNode::Point
- Defined in:
- lib/ast/merge/ast_node.rb
Overview
Point class compatible with TreeHaver::Point
Provides both method and hash-style access to row/column
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) ⇒ Object
Hash-like access for compatibility.
-
#inspect ⇒ Object
-
#to_h ⇒ Object
-
#to_s ⇒ Object
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column
45 46 47 |
# File 'lib/ast/merge/ast_node.rb', line 45 def column @column end |
#row ⇒ Object
Returns the value of attribute row
45 46 47 |
# File 'lib/ast/merge/ast_node.rb', line 45 def row @row end |
Instance Method Details
#[](key) ⇒ Object
Hash-like access for compatibility
47 48 49 50 51 52 |
# File 'lib/ast/merge/ast_node.rb', line 47 def [](key) case key when :row, "row" then row when :column, "column" then column end end |
#inspect ⇒ Object
62 63 64 |
# File 'lib/ast/merge/ast_node.rb', line 62 def inspect "#<Ast::Merge::AstNode::Point row=#{row} column=#{column}>" end |
#to_h ⇒ Object
54 55 56 |
# File 'lib/ast/merge/ast_node.rb', line 54 def to_h {row: row, column: column} end |
#to_s ⇒ Object
58 59 60 |
# File 'lib/ast/merge/ast_node.rb', line 58 def to_s "(#{row}, #{column})" end |