Class: NilVariable

Inherits:
TypeVariable show all
Defined in:
lib/core/variable/NilVariable.rb

Instance Attribute Summary

Attributes inherited from TypeVariable

#value

Attributes inherited from BaseVariable

#instance_variable, #uniq_id_history, #value, #variable_id

Attributes included from Variable

#scope_id, #uniq_id

Instance Method Summary collapse

Methods inherited from TypeVariable

#cauldron_method_calls, #describe, #equivalent?, #literalisable?, #literalise, #to_literal_string

Methods inherited from BaseVariable

#destructive_instance_calls, #find_actual_variable, #instance_calls, reset_global_id, #returning_instance_calls, #write, #write_with_uniq_id

Methods included from Variable

#increament_uniq_id!, #meets_requirements?, reset_global_id, #to_var, variable_id

Methods included from VariableIncluded

#find_actual_variable, #variable

Methods inherited from Array

#cauldron_method_calls, #contains?, #select_all, #to_intrinsic, #to_literal, #to_var, #write

Constructor Details

#initialize(id = nil) ⇒ NilVariable

Returns a new instance of NilVariable.



3
4
5
# File 'lib/core/variable/NilVariable.rb', line 3

def initialize(id=nil)
  super(nil)
end

Instance Method Details

#copyObject



7
8
9
10
11
# File 'lib/core/variable/NilVariable.rb', line 7

def copy
  copied = NilVariable.new {{:variable_id => self.variable_id,:uniq_id=>@uniq_id, :uniq_id_history=>@uniq_id_history.copy}}
  #copied.variable_id = self.variable_id
  return copied
end

#realised?Boolean

Returns:



21
22
23
# File 'lib/core/variable/NilVariable.rb', line 21

def realised?
  return true
end

#to_declarationObject



25
26
27
# File 'lib/core/variable/NilVariable.rb', line 25

def to_declaration
  return VariableDeclaration.new(self.class.to_s,nil.to_declaration)
end

#variable_id=(id) ⇒ Object

Only let this method be called from fellow NilVariable classes



14
15
16
17
18
19
# File 'lib/core/variable/NilVariable.rb', line 14

def variable_id=(id)
  unless caller.first.split(':')[0]==__FILE__
    raise StandardError.new('Illegal attempt to set variable_id')
  end
  @variable_id = id
end