Sha256: b9e968e19f810df58683d8b4033ae6cf311941ab4ff58e0c9be1310dd3e96464

Contents?: true

Size: 333 Bytes

Versions: 4

Compression:

Stored size: 333 Bytes

Contents

module Ice
  module Cubeable
    def get_cube_class(class_obj)
      begin
        cube_string = class_obj.to_s + "Cube"
        cube_string.constantize
      rescue
        get_cube_class class_obj.superclass
      end
    end

    def to_ice
      cube_class = get_cube_class self.class
      cube_class.new self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ice-0.4.3 lib/ice/cubeable.rb
ice-0.4.2 lib/ice/cubeable.rb
ice-0.4.1 lib/ice/cubeable.rb
ice-0.4.0 lib/ice/cubeable.rb