Sha256: 6e9fbe6efc4e5efec8f747b45eb126a5948fc96754056a0b733d5bb6dda8e0ab

Contents?: true

Size: 660 Bytes

Versions: 23

Compression:

Stored size: 660 Bytes

Contents

module Hobo
    class Metadata
    class << self
      attr_accessor :metadata, :store, :defaults

      def store
        @store ||= {}
      end

      def metadata
        @metadata ||= {}
      end

      def default type, value
        @defaults ||= {}
        @defaults[type] = value
        store[type] = value if store[type].nil?
      end

      def add task, type, data = nil
        data = store[type] if data.nil?
        metadata[task] ||= {}
        metadata[task][type] = data
      end

      def reset_store
        @store = {}
        @defaults.each do |k, v|
          @store[k] = v.nil? ? nil : v.dup
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.7.pre.rc1 lib/hobo/metadata.rb
hobo-inviqa-0.0.7 lib/hobo/metadata.rb
hobo-inviqa-0.0.6 lib/hobo/metadata.rb