Browse files

Fix for partials in 1.8.7

  • Loading branch information...
1 parent 6395d52 commit 7d86fc3bb9e50efad71e3cf2c1c0b789d3a41c1b @forrest committed Mar 20, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/prawnto/template_handlers/partials.rb
View
5 lib/prawnto/template_handlers/partials.rb
@@ -34,15 +34,16 @@ def get_file_path(partial_name)
def cleaned_path(provided_partial_path)
if (RUBY_VERSION > "1.8.7")
+ # This eval avoids the syntax error in 1.8.7
eval('*provided_path, file_name = provided_partial_path.split("/")')
else
splitted_provided_partial_path = provided_partial_path.split("/")
provided_path = splitted_provided_partial_path[0..-2]
file_name = splitted_provided_partial_path.last
end
- file_name = "_"+file_name unless file_name[0] == "_"
- File.join(provided_path, file_name)
+ file_name = "_"+file_name unless file_name[0].chr == "_"
+ File.join(provided_path, [file_name])
end
end

0 comments on commit 7d86fc3

Please sign in to comment.