Class: Nydp::FrozenSymbol

Inherits:
Symbol show all
Defined in:
lib/nydp/symbol.rb

Constant Summary collapse

@@frozen =
{ }

Constants inherited from Symbol

Symbol::EMPTY

Instance Attribute Summary

Attributes inherited from Symbol

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Symbol

#<, #<=>, #==, #>, #execute, find, #hash, #initialize, #inspect, #is?, new, #nydp_type, special, #to_ruby, #to_s, #to_sym, #untidy

Constructor Details

This class inherits a constructor from Nydp::Symbol

Class Method Details

.mk(name) ⇒ Object



62
63
64
65
# File 'lib/nydp/symbol.rb', line 62

def self.mk name
  name = name.to_s.to_sym
  @@frozen[name] ||= new(name)
end

Instance Method Details

#assign(v, _ = nil) ⇒ Object



71
72
73
# File 'lib/nydp/symbol.rb', line 71

def assign v, _=nil
  raise "can't assign to frozen: #{self.inspect}"
end

#value(_ = nil) ⇒ Object

Raises:



67
68
69
# File 'lib/nydp/symbol.rb', line 67

def value _=nil
  raise Unbound.new("frozen symbol: #{self.inspect}")
end