Sha256: 98644d4ab0c01c8bee1583f16634d36fcdeca55bad4d351faa22e408b29b9786
Contents?: true
Size: 401 Bytes
Versions: 3
Compression:
Stored size: 401 Bytes
Contents
module ActiveRecord module Enumerations class EnumBlock def initialize options = {} @enums = [] @last_id = 0 @options = options end def method_missing method, args = {} attrs = @options.merge(args).merge(:name => method) attrs[:id] ||= @last_id += 1 @enums << @options[:enum_class].new(attrs) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ar-enums-0.3.2 | lib/enum_block.rb |
ar-enums-0.3.1 | lib/enum_block.rb |
ar-enums-0.3.0 | lib/enum_block.rb |