Class: RazyK::Combinator

Inherits:
Node
  • Object
show all
Defined in:
lib/razyk/node.rb

Instance Attribute Summary

Attributes inherited from Node

#from, #label, #to

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#as_json, connect, disconnect, #integer, #integer?, list, #replace, #replace_child

Constructor Details

#initialize(comb) ⇒ Combinator

Returns a new instance of Combinator.



94
95
96
# File 'lib/razyk/node.rb', line 94

def initialize(comb)
  super(comb)
end

Class Method Details

.get(comb, mem) ⇒ Object



89
90
91
92
# File 'lib/razyk/node.rb', line 89

def self.get(comb, mem)
  n = comb.to_s
  mem[n] ||= self.new(comb)
end

Instance Method Details

#inspectObject



106
107
108
# File 'lib/razyk/node.rb', line 106

def inspect
  to_s
end

#to_sObject



98
99
100
101
102
103
104
105
# File 'lib/razyk/node.rb', line 98

def to_s
  case l = @label.to_s
  when "S", "K", "I"
    l
  else
    "$" + l
  end
end