Sha256: 560243ad534b4e56572f6060bb16fb4d3639a894496c7adad14e1adb353e90c2

Contents?: true

Size: 571 Bytes

Versions: 6

Compression:

Stored size: 571 Bytes

Contents

module Wukong
  module Store
    class Base
      def initialize options={}
        Log.info "Creating #{self.class} with #{options.inspect}"
      end

      #Iterate through each object casting it as a new object of klass.
      def each_as klass, &block
        self.each do |*args|
          begin
            item = klass.new *args[1..-1]
          rescue StandardError => e
            Log.info [args, e.to_s, self].join("\t")
            raise e
          end
          yield item
        end
      end

      def log_line
        nil
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wukong-3.0.0.pre old/wukong/store/base.rb
wukong-2.0.2 lib/wukong/store/base.rb
wukong-2.0.1 lib/wukong/store/base.rb
wukong-2.0.0 lib/wukong/store/base.rb
wukong-1.5.4 lib/wukong/store/base.rb
wukong-1.5.3 lib/wukong/store/base.rb