Skip to content
Browse files

lib/lingo/database.rb (register): [FIX] String#prepend and File.write…

… not available in Ruby 1.9.2.
  • Loading branch information...
1 parent fd6c2c9 commit 00b55bcf1cfc47227381442c0eb07a097c972da0 @blackwinter committed
Showing with 5 additions and 3 deletions.
  1. +2 −0 ChangeLog
  2. +1 −1 lib/lingo/database.rb
  3. +1 −1 lingoweb/lingoweb.rb
  4. +1 −1 test/ts_database.rb
View
2 ChangeLog
@@ -4,6 +4,8 @@
* Fixed regression introduced in 1.8.2 where reading input from STDIN was no
longer possible.
+* Fixed regression introduced in 1.8.2 where Lingo would no longer run on Ruby
+ 1.9.2.
== 1.8.2 [2012-04-19]
View
2 lib/lingo/database.rb
@@ -58,7 +58,7 @@ class << self
def register(klass, ext, prio = -1, meth = true)
BACKENDS.insert(prio, name = klass.name[/::(\w+)Store\z/, 1])
- Array(ext).each { |i| BACKEND_BY_EXT[i.prepend('.')] = name }
+ Array(ext).each { |i| BACKEND_BY_EXT[i.insert(0, '.')] = name }
klass.const_set(:EXT, ext)
klass.class_eval('def store_ext; EXT; end', __FILE__, __LINE__) if meth
View
2 lingoweb/lingoweb.rb
@@ -37,7 +37,7 @@
CREDS = pass ? [user, pass] : []
- File.write(AUTH, CREDS.join(':'))
+ File.open(AUTH, 'w') { |f| f.write(CREDS.join(':')) }
end
use Rack::Auth::Basic do |*creds|
View
2 test/ts_database.rb
@@ -250,7 +250,7 @@ def test_multikey
def compare(config, input, output = nil)
FileUtils.mkdir_p(File.dirname(TEST_FILE))
- File.write(TEST_FILE, input, encoding: Lingo::ENC)
+ File.open(TEST_FILE, 'w', encoding: Lingo::ENC) { |f| f.write(input) }
Lingo::Database.open(set_config('tst', config.merge('name' => TEST_FILE)), @lingo) { |db|
if block_given?

0 comments on commit 00b55bc

Please sign in to comment.
Something went wrong with that request. Please try again.