Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added compatibility layer for Ruby 1.8. Fixed bug in previous release

  • Loading branch information...
commit 58ce34a09d89be499e11769dae8fbc82df3a2ed5 1 parent 5f2d277
@soveran soveran authored
View
1  lib/ohm.rb
@@ -1,6 +1,7 @@
# encoding: UTF-8
require "base64"
+require File.join(File.dirname(__FILE__), "ohm", "compat")
require File.join(File.dirname(__FILE__), "ohm", "redis")
require File.join(File.dirname(__FILE__), "ohm", "validations")
View
12 lib/ohm/compat.rb
@@ -0,0 +1,12 @@
+# encoding: UTF-8
+
+# This file provides Ruby 1.8 compatibility. The intended functionality
+# is not present, because we cannot guess the original encoding, thus
+# making Iconv unsuitable for a conversion.
+if RUBY_VERSION < "1.9"
+ class String
+ def force_encoding(encoding)
+ self
+ end
+ end
+end
View
4 ohm.gemspec
@@ -1,11 +1,11 @@
Gem::Specification.new do |s|
s.name = 'ohm'
- s.version = '0.0.23'
+ s.version = '0.0.24'
s.summary = %{Object-hash mapping library for Redis.}
s.description = %Q{Ohm is a library that allows to store an object in Redis, a persistent key-value database. It includes an extensible list of validations and has very good performance.}
s.authors = ["Michel Martens", "Damian Janowski"]
s.email = ["michel@soveran.com", "djanowski@dimaion.com"]
s.homepage = "http://github.com/soveran/ohm"
- s.files = ["lib/ohm/redis.rb", "lib/ohm/validations.rb", "lib/ohm.rb", "README.markdown", "LICENSE", "Rakefile", "test/all_tests.rb", "test/benchmarks.rb", "test/connection_test.rb", "test/errors_test.rb", "test/indices_test.rb", "test/model_test.rb", "test/mutex_test.rb", "test/redis_test.rb", "test/test_helper.rb", "test/validations_test.rb", "test/test.conf"]
+ s.files = ["lib/ohm/compat.rb", "lib/ohm/redis.rb", "lib/ohm/validations.rb", "lib/ohm.rb", "README.markdown", "LICENSE", "Rakefile", "test/all_tests.rb", "test/benchmarks.rb", "test/connection_test.rb", "test/errors_test.rb", "test/indices_test.rb", "test/model_test.rb", "test/mutex_test.rb", "test/redis_test.rb", "test/test_helper.rb", "test/validations_test.rb", "test/test.conf"]
s.rubyforge_project = "ohm"
end
View
2  ohm.gemspec.erb
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'ohm'
- s.version = '0.0.23'
+ s.version = '0.0.24'
s.summary = %{Object-hash mapping library for Redis.}
s.description = %Q{Ohm is a library that allows to store an object in Redis, a persistent key-value database. It includes an extensible list of validations and has very good performance.}
s.authors = ["Michel Martens", "Damian Janowski"]
View
6 test/model_test.rb
@@ -1,3 +1,5 @@
+# encoding: UTF-8
+
require File.join(File.dirname(__FILE__), "test_helper")
require "ostruct"
@@ -74,8 +76,8 @@ def validate
end
should "save the attributes in UTF8" do
- event = Meetup.create(:name => "Ruby Tuesday")
- assert_equal "UTF-8", Meetup[event.id].name.encoding.to_s
+ event = Meetup.create(:name => "32° Kisei-sen")
+ assert_equal "32° Kisei-sen", Meetup[event.id].name
end
should "delete the attribute if set to nil" do
Please sign in to comment.
Something went wrong with that request. Please try again.