Class: XfOOrth::AbstractWordSpec
- Defined in:
- lib/fOOrth/compiler/word_specs.rb
Overview
The abstract base class for all of the different sorts of word specs.
Direct Known Subclasses
ClassSpec, GlobalVarSpec, InstanceVarSpec, LocalSpec, MacroSpec, NosSpec, SelfSpec, ThreadVarSpec, TosSpec, VmSpec
Instance Attribute Summary collapse
-
#builds ⇒ Object
readonly
The compile-time text inserted into the buffer.
-
#does ⇒ Object
readonly
The run-time action; The block that gets linked to the method’s symbol.
-
#tags ⇒ Object
readonly
The attributes tagged to this specification.
Instance Method Summary collapse
-
#get_stub_action(name, symbol) ⇒ Object
Get the default action if none is specified.
-
#has_tag?(tag) ⇒ Boolean
Look up an tag of interest.
-
#initialize(name, symbol, tags = [], &block) ⇒ AbstractWordSpec
constructor
Set up the method spec.
Constructor Details
#initialize(name, symbol, tags = [], &block) ⇒ AbstractWordSpec
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 may include:
-
:immediate - The word is executed, even in compile modes.
-
:macro - Identifies the spec as a macro spec to assist debugging.
-
:stub - The word is a place holder in the hierarchy.
Endemic Code Smells
-
:reek:ControlParameter – false positive
30 31 32 33 34 |
# File 'lib/fOOrth/compiler/word_specs.rb', line 30 def initialize(name, symbol, =[], &block) @tags = @does = block || get_stub_action(name, symbol) build_builds_string(name, symbol) end |
Instance Attribute Details
#builds ⇒ Object (readonly)
The compile-time text inserted into the buffer.
11 12 13 |
# File 'lib/fOOrth/compiler/word_specs.rb', line 11 def builds @builds end |
#does ⇒ Object (readonly)
The run-time action; The block that gets linked to the method’s symbol.
14 15 16 |
# File 'lib/fOOrth/compiler/word_specs.rb', line 14 def does @does end |
#tags ⇒ Object (readonly)
The attributes tagged to this specification.
17 18 19 |
# File 'lib/fOOrth/compiler/word_specs.rb', line 17 def @tags end |
Instance Method Details
#get_stub_action(name, symbol) ⇒ Object
Get the default action if none is specified.
37 38 39 40 41 |
# File 'lib/fOOrth/compiler/word_specs.rb', line 37 def get_stub_action(name, symbol) lambda do |*_any| error "F20: A #{self.foorth_name} does not understand #{name} (#{symbol.inspect})." end end |
#has_tag?(tag) ⇒ Boolean
Look up an tag of interest.
44 45 46 |
# File 'lib/fOOrth/compiler/word_specs.rb', line 44 def has_tag?(tag) @tags.include?(tag) end |