Sha256: 6b48947e1bda4833588964c6c4c03d5430d4211ac39ab8e7e55e4df330c0c232

Contents?: true

Size: 687 Bytes

Versions: 39

Compression:

Stored size: 687 Bytes

Contents

module ZTK::DSL::Core

  # @author Zachary Patten <zachary AT jovelabs DOT com>
  # @api private
  module Dataset

    def self.included(base)
      base.class_eval do
        base.send(:extend, ZTK::DSL::Core::Dataset::ClassMethods)
      end
    end

    # @author Zachary Patten <zachary AT jovelabs DOT com>
    module ClassMethods

      def dataset
        klass = self.to_s.underscore.to_sym
        @@dataset ||= {}
        if @@dataset.key?(klass)
          @@dataset[klass]
        else
          @@dataset[klass] ||= []
        end
      end

      def purge
        @@dataset = nil
      end

      def id
        @@id ||= 0
        (@@id += 1)
      end

    end

  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
ztk-1.5.0 lib/ztk/dsl/core/dataset.rb
ztk-1.4.22 lib/ztk/dsl/core/dataset.rb
ztk-1.4.21 lib/ztk/dsl/core/dataset.rb
ztk-1.4.20 lib/ztk/dsl/core/dataset.rb
ztk-1.4.19 lib/ztk/dsl/core/dataset.rb
ztk-1.4.18 lib/ztk/dsl/core/dataset.rb
ztk-1.4.17 lib/ztk/dsl/core/dataset.rb
ztk-1.4.16 lib/ztk/dsl/core/dataset.rb
ztk-1.4.15 lib/ztk/dsl/core/dataset.rb
ztk-1.4.14 lib/ztk/dsl/core/dataset.rb
ztk-1.4.13 lib/ztk/dsl/core/dataset.rb
ztk-1.4.12 lib/ztk/dsl/core/dataset.rb
ztk-1.4.11 lib/ztk/dsl/core/dataset.rb
ztk-1.4.10 lib/ztk/dsl/core/dataset.rb
ztk-1.4.9 lib/ztk/dsl/core/dataset.rb
ztk-1.4.8 lib/ztk/dsl/core/dataset.rb
ztk-1.4.7 lib/ztk/dsl/core/dataset.rb
ztk-1.4.6 lib/ztk/dsl/core/dataset.rb
ztk-1.4.5 lib/ztk/dsl/core/dataset.rb