class Nydp::Symbol
Constants
- EMPTY
Attributes
name[RW]
Public Class Methods
find(name, ns ;)
click to toggle source
# File lib/nydp/symbol.rb, line 41 def self.find name, ns ; ns[name.to_sym] ; end
new(name)
click to toggle source
Calls superclass method
# File lib/nydp/symbol.rb, line 6 def self.new name special(name.to_s.to_sym) || super end
new(name)
click to toggle source
# File lib/nydp/symbol.rb, line 10 def initialize name name = name.to_s @name = name.to_sym raise "cannot be symbol : #{name.inspect}" if @name == :nil || @name == :t @inspection = "|#{name.gsub(/\|/, '\|')}|" if untidy(name) end
special(name)
click to toggle source
# File lib/nydp/symbol.rb, line 35 def self.special name return nil if name == :nil return true if name == :t nil end
Public Instance Methods
<(other ;)
click to toggle source
# File lib/nydp/symbol.rb, line 50 def < other ; self.name < other.name ; end
<=>(other ;)
click to toggle source
# File lib/nydp/symbol.rb, line 51 def <=> other ; self.name <=> other.name ; end
==(other)
click to toggle source
# File lib/nydp/symbol.rb, line 59 def == other other.is_a?(Nydp::Symbol) && (self.name == other.name) end
Also aliased as: eql?
>(other ;)
click to toggle source
# File lib/nydp/symbol.rb, line 49 def > other ; self.name > other.name ; end
assign(value, _=nil ;)
click to toggle source
# File lib/nydp/symbol.rb, line 52 def assign value, _=nil ; @value = value ; end
compile_to_ruby(indent, src, opts=nil)
click to toggle source
# File lib/nydp/symbol.rb, line 31 def compile_to_ruby indent, src, opts=nil "#{indent}ns.#{ruby_name}" end
hash()
click to toggle source
# File lib/nydp/symbol.rb, line 17 def hash ; name.hash ; end
inspect()
click to toggle source
# File lib/nydp/symbol.rb, line 44 def inspect ; @inspection || name.to_s ; end
is?(nm ;)
click to toggle source
# File lib/nydp/symbol.rb, line 48 def is? nm ; self.name == nm.to_sym ; end
ns_assign(ns, value)
click to toggle source
# File lib/nydp/symbol.rb, line 54 def ns_assign ns, value value.is_named(@name) if value.respond_to?(:is_named) ns.send(:"#{ruby_name}=", value) end
nydp_type()
click to toggle source
# File lib/nydp/symbol.rb, line 43 def nydp_type ; :symbol ; end
ruby_name()
click to toggle source
# File lib/nydp/symbol.rb, line 27 def ruby_name "ns_#{name.to_s._nydp_name_to_rb_name}" end
to_ruby()
click to toggle source
# File lib/nydp/symbol.rb, line 47 def to_ruby ; to_sym ; end
to_s()
click to toggle source
# File lib/nydp/symbol.rb, line 45 def to_s ; name.to_s ; end
to_sym()
click to toggle source
# File lib/nydp/symbol.rb, line 46 def to_sym ; name ; end
untidy(str)
click to toggle source
# File lib/nydp/symbol.rb, line 19 def untidy str (str == "") || (str == nil) || (str =~ /[\s\|,\(\)"]/) end
value(context=nil)
click to toggle source
# File lib/nydp/symbol.rb, line 23 def value context=nil @value end