Class: Forthic::Word

Inherits:
Object
  • Object
show all
Defined in:
lib/forthic/words/word.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Word

Returns a new instance of Word.

Parameters:

  • name (String)


8
9
10
11
12
# File 'lib/forthic/words/word.rb', line 8

def initialize(name)
  @name = name
  @string = name
  @location = nil
end

Instance Attribute Details

#locationObject

Returns the value of attribute location.



5
6
7
# File 'lib/forthic/words/word.rb', line 5

def location
  @location
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/forthic/words/word.rb', line 5

def name
  @name
end

#stringObject

Returns the value of attribute string.



5
6
7
# File 'lib/forthic/words/word.rb', line 5

def string
  @string
end

Instance Method Details

#execute(_interp, _options = {}) ⇒ Object

Parameters:

  • _interp (Interpreter)
  • _options (Hash) (defaults to: {})


26
27
28
# File 'lib/forthic/words/word.rb', line 26

def execute(_interp, _options = {})
  raise "Must override Word.execute"
end

#get_locationCodeLocation?

Returns:



20
21
22
# File 'lib/forthic/words/word.rb', line 20

def get_location
  @location
end

#set_location(location) ⇒ Object

Parameters:



15
16
17
# File 'lib/forthic/words/word.rb', line 15

def set_location(location)
  @location = location
end