Sha256: 2c942c8cae67b820dcc4e71d713f9f925f009fbd51314c9c0e10ae22c93ba066

Contents?: true

Size: 339 Bytes

Versions: 7

Compression:

Stored size: 339 Bytes

Contents

class Object
  def to_ice
    nil
  end
end

[FalseClass, TrueClass, Numeric, String].each do |cls|
  cls.class_eval do
    def to_ice
      self
    end
  end
end

class Array
  def to_ice
    map &:to_ice
  end
end

class Hash
  def to_ice
    res = {}
    each_pair do |key,value|
      res[key] = value.to_ice
    end
    res
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ice-0.5.1 lib/ice/cube_helpers.rb
ice-0.5.0 lib/ice/cube_helpers.rb
ice-0.4.4 lib/ice/cube_helpers.rb
ice-0.4.3 lib/ice/cube_helpers.rb
ice-0.4.2 lib/ice/cube_helpers.rb
ice-0.4.1 lib/ice/cube_helpers.rb
ice-0.4.0 lib/ice/cube_helpers.rb