lib/tafel.rb in tafel-0.3.0 vs lib/tafel.rb in tafel-1.0.0
- old
+ new
@@ -23,11 +23,11 @@
#++
module Tafel
- VERSION = '0.3.0'
+ VERSION = '1.0.0'
def self.table?(o)
o.is_a?(Array) && o.all? { |r| r.is_a?(Array) }
end
@@ -39,10 +39,10 @@
return x if limit == 0
case x
when Hash then x.to_a.collect { |k, v| [ k, to_vtable(v, limit - 1) ] }
- when Array then x.collect { |e| [ to_vtable(e) ] }
+ when Array then x.inject([]) { |a, e| a << [ a.size, to_vtable(e) ]; a }
else x
end
end
def self.to_htable(x)