Sha256: f80729ab7f7a633c13b624c6a4b4d1b58633c34c97fbeca401791af1d4d8bf08
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 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 klass = self.to_s.underscore.to_sym @@dataset ||= {} @@dataset[klass] = [] @@id ||= {} @@id[klass] = 0 true end def next_id klass = self.to_s.underscore.to_sym @@id ||= {} @@id[klass] ||= 0 @@id[klass] += 1 @@id[klass] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ztk-1.6.19 | lib/ztk/dsl/core/dataset.rb |