Class: Sfp::Undefined

Inherits:
Object
  • Object
show all
Defined in:
lib/sfp/Sfplib.rb

Overview

Instance of this class will be returned as the value of a non-exist variable

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = nil, type = nil) ⇒ Undefined

Returns a new instance of Undefined.



182
183
184
185
# File 'lib/sfp/Sfplib.rb', line 182

def initialize(path=nil, type=nil)
	@path = path
	@type = type
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



181
182
183
# File 'lib/sfp/Sfplib.rb', line 181

def path
  @path
end

#typeObject

Returns the value of attribute type.



181
182
183
# File 'lib/sfp/Sfplib.rb', line 181

def type
  @type
end

Class Method Details

.create(type) ⇒ Object



175
176
177
178
179
# File 'lib/sfp/Sfplib.rb', line 175

def self.create(type)
	@@list = {} if !defined? @@list
	return @@list[type] if @@list.has_key?(type)
	(@@list[type] = Undefined.new(nil, type))
end

Instance Method Details

#to_sObject



187
188
189
# File 'lib/sfp/Sfplib.rb', line 187

def to_s
	(@type.nil? ? "$.Undefined" : "$.Undefined.#{@type}")
end