Sha256: 1a81d0cf12f06851bdee306896577545cd78d3d9f073507a394391e8a4370d96
Contents?: true
Size: 757 Bytes
Versions: 2
Compression:
Stored size: 757 Bytes
Contents
require_relative 'enum' require_relative 'dictionary' require_relative 'errors' require_relative 'definer' require_relative 'active_record_definer' if defined?(ActiveRecord::Base) module EnumIsh module Base extend ActiveSupport::Concern included do class_attribute :_enum_ish_enums self._enum_ish_enums = {} end class_methods do def enum_ish(name, map, config = {}) enum = Enum.new(name, map, config) self._enum_ish_enums = _enum_ish_enums.merge(name.to_sym => enum) if defined?(ActiveRecord::Base) && self.ancestors.include?(ActiveRecord::Base) ActiveRecordDefiner.new(self).define(enum) else Definer.new(self).define(enum) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
enum_ish-1.5.1 | lib/enum_ish/base.rb |
enum_ish-1.5.0 | lib/enum_ish/base.rb |