Class: RubimCode::Isolator

Inherits:
Object show all
Defined in:
lib/rubimc.rb

Overview

end Interrupts class

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.enabledObject

Returns the value of attribute enabled.



247
248
249
# File 'lib/rubimc.rb', line 247

def enabled
  @enabled
end

.local_variablesObject

Returns the value of attribute local_variables.



246
247
248
# File 'lib/rubimc.rb', line 246

def local_variables
  @local_variables
end

.outside_bindingObject

Returns the value of attribute outside_binding.



245
246
247
# File 'lib/rubimc.rb', line 245

def outside_binding
  @outside_binding
end

Class Method Details

.permit!(var) ⇒ Object



250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/rubimc.rb', line 250

def self.permit!(var)
  return unless self.enabled
  return unless self.outside_binding
  return unless var.is_a? UserVariable
  return if var.type.in? ["fixed", "expression", "undefined", nil]
  return if var.type === /^tmp/

  if !local_variables.include?(var.name) and 
    outside_binding.local_variable_defined?(var.name.to_sym)
      RubimCode.perror "Undefined variable '#{var.name}'. To pass params in interruprts use instance variables: '@#{var.name}'"
  end
end

.runObject



263
264
265
266
# File 'lib/rubimc.rb', line 263

def self.run
       self.local_variables = []
  self.enabled = true
end

.stopObject



268
269
270
# File 'lib/rubimc.rb', line 268

def self.stop
  self.enabled = false
end