Permalink
Browse files

create load_path dynamicaly

  • Loading branch information...
1 parent c90e181 commit 7992ca282f3f13f89bcf59e27c39b77ca5762eb2 @pejuko pejuko committed Mar 17, 2011
Showing with 7 additions and 3 deletions.
  1. +5 −1 lib/ruby_warrior/level.rb
  2. +1 −1 lib/ruby_warrior/profile.rb
  3. +1 −1 lib/ruby_warrior/tower.rb
View
6 lib/ruby_warrior/level.rb
@@ -24,7 +24,11 @@ def player_path
end
def load_path
- @profile.tower_path + "/level_" + @number.to_s.rjust(3, '0') + ".rb"
+ File.join(
+ File.expand_path(File.dirname(__FILE__) + '/../../towers/'),
+ File.basename(@profile.tower_path) + "/level_" +
+ @number.to_s.rjust(3, '0') + ".rb"
+ )
end
def load_level
View
2 lib/ruby_warrior/profile.rb
@@ -62,7 +62,7 @@ def epic_score_with_grade
end
def tower
- Tower.new(@tower_path)
+ Tower.new(File.basename @tower_path)
end
def current_level
View
2 lib/ruby_warrior/tower.rb
@@ -3,7 +3,7 @@ class Tower
attr_reader :path
def initialize(path)
- @path = path
+ @path = File.join(File.expand_path(File.dirname(__FILE__) + '/../../towers/'), path)
end
def name

0 comments on commit 7992ca2

Please sign in to comment.