Class: Sfp::Unknown

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

Overview

Instance of this class will be return as the value of an unknown variable in open-world assumption.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Unknown.



202
203
204
205
# File 'lib/sfp/Sfplib.rb', line 202

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

Instance Attribute Details

#pathObject

Returns the value of attribute path.



201
202
203
# File 'lib/sfp/Sfplib.rb', line 201

def path
  @path
end

#typeObject

Returns the value of attribute type.



201
202
203
# File 'lib/sfp/Sfplib.rb', line 201

def type
  @type
end

Class Method Details

.create(type) ⇒ Object



195
196
197
198
199
# File 'lib/sfp/Sfplib.rb', line 195

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

Instance Method Details

#to_sObject



207
208
209
# File 'lib/sfp/Sfplib.rb', line 207

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