class XfOOrth::AbstractWordSpec

The abstract base class for all of the different sorts of word specs.

Get information about this word spec.

Attributes

builds[R]

The compile-time text inserted into the buffer.

does[R]

The run-time action; The block that gets linked to the method's symbol.

tags[R]

The attributes tagged to this specification.

Public Class Methods

new(name, symbol, tags, &block) click to toggle source

Set up the method spec.
Parameters:

  • name - The string that maps to the symbol.

  • symbol - The symbol that the name maps to.

  • tags - A an array of tags.


These include:

  • :class - This spec defines a class.

  • :immediate - The word is executed, even in compile modes.

  • :macro - This spec defines an in-line macro.

  • :stub - The word is a place holder in the hierarchy.

  • :temp - A temporary spec used during compilation.

  • none - Nothing special here. Move along, move along.


Endemic Code Smells

  • :reek:ControlParameter – false positive

# File lib/fOOrth/compiler/word_specs.rb, line 33
def initialize(name, symbol, tags, &block)
  @tags = tags
  @does = block || get_stub_action(name, symbol)
  build_builds_string(name, symbol)
end

Public Instance Methods

get_info() click to toggle source

Get introspection info.

# File lib/fOOrth/library/introspection/word_specs.rb, line 10
def get_info
  [["Spec"  , self.class.foorth_name],
   ["Tags"  , tags.join(' ')],
   ["Builds", builds],
   ["Does"  , does.inspect]]
end
get_stub_action(name, symbol) click to toggle source

Get the default action if none is specified.

# File lib/fOOrth/compiler/word_specs.rb, line 40
def get_stub_action(name, symbol)
  lambda do |*_any|
    f20_error(self, name, symbol)
  end
end
has_tag?(tag) click to toggle source

Look up a tag of interest.

# File lib/fOOrth/compiler/word_specs.rb, line 47
def has_tag?(tag)
  @tags.include?(tag)
end