class MTK::Lang::Variable
A placeholder element for a variable value, for use within a {Patterns::Pattern} such as a {Patterns::ForEach} pattern. Will be evaluated to an actual value by the Pattern or Sequencer
Attributes
name[R]
value[RW]
Public Class Methods
new(name, value=nil)
click to toggle source
# File lib/mtk/lang/variable.rb, line 12 def initialize name, value=nil @name = name @value = value @implicit = !!(name =~ /^\$+$/) end
Public Instance Methods
==(other)
click to toggle source
# File lib/mtk/lang/variable.rb, line 23 def == other other.is_a? self.class and other.name == self.name end
implicit?()
click to toggle source
@return true when this variable has no specific value and references the implicit variable stack (such as in a {Patterns::ForEach})
# File lib/mtk/lang/variable.rb, line 19 def implicit? @implicit end
to_s()
click to toggle source
# File lib/mtk/lang/variable.rb, line 27 def to_s "#{self.class}<#{name}#{'='+value.to_s if value}>" end