Class: Gamefic::Script::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gamefic/script/base.rb

Direct Known Subclasses

File, Text

Instance Method Summary collapse

Constructor Details

#initializeBase



4
5
6
# File 'lib/gamefic/script/base.rb', line 4

def initialize
  raise "#initialize must be defined in subclasses"
end

Instance Method Details

#==(other) ⇒ Boolean

Script objects are equal if their relative paths are the same. Note that they are still considered equal if their absolute paths are different, or even if they come from different types of sources.



33
34
35
# File 'lib/gamefic/script/base.rb', line 33

def==(other)
  path == other.path
end

#absolute_pathString

Get the absolute path of the script’s original file, or its URL for sources that are not file-based.



24
25
26
# File 'lib/gamefic/script/base.rb', line 24

def absolute_path
  raise "#absolute_path must be defined in subclasses"
end

#pathString

Get the script’s path.



17
18
19
# File 'lib/gamefic/script/base.rb', line 17

def path
  raise "#path must be defined in subclasses"
end

#readString

Get the script’s text. The text must be source code suitable for evaluation via Plot#stage.



11
12
13
# File 'lib/gamefic/script/base.rb', line 11

def read
  raise "#read must be defined in subclasses"
end