Class: Gamefic::Source::File
Constant Summary collapse
- @@extensions =
['.plot.rb', '.plot', '.rb']
Instance Attribute Summary collapse
-
#directories ⇒ Object
readonly
Returns the value of attribute directories.
-
#main_dir ⇒ Object
Returns the value of attribute main_dir.
Instance Method Summary collapse
- #export(path) ⇒ Object
-
#initialize(*directories) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(*directories) ⇒ File
Returns a new instance of File.
7 8 9 |
# File 'lib/gamefic/source/file.rb', line 7 def initialize(*directories) @directories = directories || [] end |
Instance Attribute Details
#directories ⇒ Object (readonly)
Returns the value of attribute directories.
5 6 7 |
# File 'lib/gamefic/source/file.rb', line 5 def directories @directories end |
#main_dir ⇒ Object
Returns the value of attribute main_dir.
6 7 8 |
# File 'lib/gamefic/source/file.rb', line 6 def main_dir @main_dir end |
Instance Method Details
#export(path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/gamefic/source/file.rb', line 10 def export path @directories.each { |directory| @@extensions.each { |ext| abs_file = File.join(directory, path + ext) if File.file?(abs_file) return Script::File.new(abs_file, path) end } } raise LoadError.new("cannot load script -- #{path}") end |