Skip to content
Browse files

Add a hash extension to generate a ModestModel::Object from a hash vi…

…a hash.to_modest_model
  • Loading branch information...
1 parent c27aa3e commit 31d47566041b72aedc0b24c9746e5bb0216ca5a7 Mike Fulcher committed Aug 9, 2011
Showing with 7 additions and 0 deletions.
  1. +2 −0 lib/modest_model.rb
  2. +5 −0 lib/modest_model/hash.rb
View
2 lib/modest_model.rb
@@ -4,6 +4,8 @@
retry if require('rubygems')
end
+require File.expand_path('../modest_model/hash', __FILE__)
+
module ModestModel
autoload :Object, File.expand_path('../modest_model/object', __FILE__)
end
View
5 lib/modest_model/hash.rb
@@ -0,0 +1,5 @@
+class Hash
+ def to_modest_model
+ ModestModel::Object.new(self)
+ end
+end

0 comments on commit 31d4756

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