Sha256: 29f6340c0f390bc7b59be1dfb7f292d311439ab143da5ae933a0c91a331b2c6b
Contents?: true
Size: 436 Bytes
Versions: 8
Compression:
Stored size: 436 Bytes
Contents
module ActiveRecord module Enumerations class EnumBlock def initialize enum_class, options = {} @enums = [] @last_id = 0 @enum_class = enum_class @options = options end def method_missing method, args = {} attrs = @options.merge(args).merge(:name => method) attrs[:id] ||= @last_id += 1 @enums << @enum_class.new(attrs) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems