Permalink
Browse files

Merge pull request #24 from bseanvt/master

Fix for Rails 3.1 and Ruby 1.9.2 (check trailing whitespace after document separators when formatting final output)
  • Loading branch information...
2 parents bec9ecf + 14ebdb7 commit c67dc36ad2f9aeefcad2bdc6cfd75307568b88d6 @ludicast ludicast committed Oct 12, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/yaml_db.rb
View
@@ -8,7 +8,7 @@
module YamlDb
module Helper
def self.loader
- YamlDb::Load
+ YamlDb::Load
end
def self.dumper
@@ -24,15 +24,15 @@ def self.extension
module Utils
def self.chunk_records(records)
yaml = [ records ].to_yaml
- yaml.sub!("--- \n", "")
+ yaml.sub!(/---\s\n|---\n/, '')
yaml.sub!('- - -', ' - -')
yaml
end
end
class Dump < SerializationHelper::Dump
-
+
def self.dump_table_columns(io, table)
io.write("\n")
io.write({ table => { 'columns' => table_column_names(table) } }.to_yaml)
@@ -56,7 +56,7 @@ def self.table_record_header(io)
end
class Load < SerializationHelper::Load
- def self.load_documents(io, truncate = true)
+ def self.load_documents(io, truncate = true)
YAML.load_documents(io) do |ydoc|
ydoc.keys.each do |table_name|
next if ydoc[table_name].nil?
@@ -68,7 +68,7 @@ def self.load_documents(io, truncate = true)
class Railtie < Rails::Railtie
rake_tasks do
- load File.expand_path('../tasks/yaml_db_tasks.rake',
+ load File.expand_path('../tasks/yaml_db_tasks.rake',
__FILE__)
end
end

0 comments on commit c67dc36

Please sign in to comment.