Sha256: 411f420727fe6dbcc2fc19fe8b7112f6d4b31f687549b0e5262d1a69b1b2069f
Contents?: true
Size: 695 Bytes
Versions: 3
Compression:
Stored size: 695 Bytes
Contents
require 'bitmask_attributes/definition' require 'bitmask_attributes/value_proxy' module BitmaskAttributes extend ActiveSupport::Concern module ClassMethods def bitmask(attribute, options={}, &extension) unless options[:as] && options[:as].kind_of?(Array) raise ArgumentError, "Must provide an Array :as option" end bitmask_definitions[attribute] = Definition.new(attribute, options[:as].to_a, &extension) bitmask_definitions[attribute].install_on(self) end def bitmask_definitions @bitmask_definitions ||= {} end def bitmasks @bitmasks ||= {} end end end ActiveRecord::Base.send :include, BitmaskAttributes
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bitmask_attributes-0.2.4 | lib/bitmask_attributes.rb |
bitmask_attributes-0.2.3 | lib/bitmask_attributes.rb |
bitmask_attributes-0.2.2 | lib/bitmask_attributes.rb |