Class: XfOOrth::ClassSpec

Inherits:
AbstractWordSpec show all
Defined in:
lib/fOOrth/compiler/word_specs.rb

Overview

A class used to specify the compile of fOOrth classes.

Instance Attribute Summary collapse

Attributes inherited from AbstractWordSpec

#builds, #does, #tags

Instance Method Summary collapse

Methods inherited from AbstractWordSpec

#get_stub_action, #has_tag?, #initialize

Constructor Details

This class inherits a constructor from XfOOrth::AbstractWordSpec

Instance Attribute Details

#new_classObject (readonly)

Give read access to the class for testing.



118
119
120
# File 'lib/fOOrth/compiler/word_specs.rb', line 118

def new_class
  @new_class
end

Instance Method Details

#build_builds_string(new_class, _symbol) ⇒ Object

Generate the Ruby code for this fOOrth class.
Parameters:

  • new_class - The string that maps to the symbol.

  • _symbol - The symbol that the name maps to. Unused



112
113
114
115
# File 'lib/fOOrth/compiler/word_specs.rb', line 112

def build_builds_string(new_class, _symbol)
  @new_class = new_class
  @builds = "vm.push(#{new_class.name}); "
end