Skip to content
Browse files

fix a ruby 1.9 issue

  • Loading branch information...
1 parent 4af2312 commit bdc23ce6c5006f49817e7f1ea2ceb41a93124eea @mkristian committed
Showing with 5 additions and 6 deletions.
  1. +1 −3 README.md
  2. +3 −2 lib/babel/hash_filter.rb
  3. +1 −1 vellam.gemspec
View
4 README.md
@@ -1,6 +1,4 @@
-[![Build Status](https://secure.travis-ci.org/mkristian/babel.png)](http://travis-ci.org/mkristian/babel)
-
-# babel #
+# vellam [![Build Status](https://secure.travis-ci.org/mkristian/babel.png)](http://travis-ci.org/mkristian/babel) #
rails comes with `to_json` and `to_xml` on models and you can give them an option map to control how the whole object tree gets serialized.
View
5 lib/babel/hash_filter.rb
@@ -106,12 +106,13 @@ def filter_data(model, data, options = {}, &block)
when Array
if include.include?(k)
models = model.send(k)
+ j = -1
case include
when Array
- result[k] = v.enum_with_index.collect { |i, j| filter_data(models[j], i, &block) }
+ result[k] = v.collect { |i| j += 1; filter_data(models[j], i, &block) }
when Hash
opts = include[k]
- result[k] = v.enum_with_index.collect { |i, j| filter_data(models[j], i, opts, &block) }
+ result[k] = v.collect { |i| j += 1; filter_data(models[j], i, opts, &block) }
end
end
else
View
2 vellam.gemspec
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'vellam'
- s.version = '0.1'
+ s.version = '0.1.1'
s.summary = 'babel offers a filter for hashes and with that comes json/yaml/xml de/serialization of models which provides a hash representation'
s.description = 'babel offers a filter for hashes and with that comes json/yaml/xml de/serialization of models which provides a hash representationi. possible models are activerecord, activemodel, resources from datamapper, virtus'

0 comments on commit bdc23ce

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