Class: Liquid2::StaticAnalysis::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/liquid2/static_analysis.rb

Overview

A variable as a sequence of segments and its location.

Constant Summary collapse

RE_PROPERTY =
/\A[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*\Z/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(segments, span) ⇒ Variable

Returns a new instance of Variable.



54
55
56
57
# File 'lib/liquid2/static_analysis.rb', line 54

def initialize(segments, span)
  @segments = segments
  @span = span
end

Instance Attribute Details

#segmentsObject (readonly)

Returns the value of attribute segments.



50
51
52
# File 'lib/liquid2/static_analysis.rb', line 50

def segments
  @segments
end

#spanObject (readonly)

Returns the value of attribute span.



50
51
52
# File 'lib/liquid2/static_analysis.rb', line 50

def span
  @span
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



63
64
65
66
67
# File 'lib/liquid2/static_analysis.rb', line 63

def ==(other)
  self.class == other.class &&
    @segments == other.segments &&
    @span == other.span
end

#hashObject



71
72
73
# File 'lib/liquid2/static_analysis.rb', line 71

def hash
  @segments.hash
end

#to_sObject



59
60
61
# File 'lib/liquid2/static_analysis.rb', line 59

def to_s
  segments_to_s(@segments)
end