Class: RubyWarrior::PlayerGenerator
- Inherits:
-
Object
- Object
- RubyWarrior::PlayerGenerator
- Defined in:
- lib/ruby_armor/ruby_warrior_ext/player_generator.rb
Instance Method Summary collapse
Instance Method Details
#generate ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/ruby_armor/ruby_warrior_ext/player_generator.rb', line 3 def generate if level.number == 1 FileUtils.mkdir_p(level.player_path) # Read and write, so that line-endings are correct for the OS. File.open(level.player_path + '/player.rb', "w") do |f| f.write File.read(templates_path + '/player.rb') end end File.open(level.player_path + '/README', 'w') do |f| f.write read_template(templates_path + '/README.erb') end end |