Class: Cyrel::Expression::PropertyAccess

Inherits:
Base
  • Object
show all
Defined in:
lib/cyrel/expression/property_access.rb

Overview

Represents accessing a property on a variable (node or relationship alias). Example: n.name, r.since

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#!=, #%, #&, #*, #+, #-, #/, #<, #<=, #==, #=~, #>, #>=, #^, #|

Constructor Details

#initialize(variable, property_name) ⇒ PropertyAccess

Returns a new instance of PropertyAccess.

Parameters:

  • variable (Symbol, String)

    The alias of the node/relationship.

  • property_name (Symbol, String)

    The name of the property to access.



12
13
14
15
# File 'lib/cyrel/expression/property_access.rb', line 12

def initialize(variable, property_name)
  @variable = variable.to_sym
  @property_name = property_name.to_sym
end

Instance Attribute Details

#property_nameObject (readonly)

Returns the value of attribute property_name.



8
9
10
# File 'lib/cyrel/expression/property_access.rb', line 8

def property_name
  @property_name
end

#variableObject (readonly)

Returns the value of attribute variable.



8
9
10
# File 'lib/cyrel/expression/property_access.rb', line 8

def variable
  @variable
end

Instance Method Details

#render(_query) ⇒ String

Renders the property access expression.

Parameters:

  • _query (Cyrel::Query)

    The query object (unused for simple property access).

Returns:

  • (String)

    The Cypher string fragment (e.g., “n.name”).



20
21
22
# File 'lib/cyrel/expression/property_access.rb', line 20

def render(_query)
  "#{@variable}.#{@property_name}"
end