Module: BitfieldAttribute::Base::ClassMethods
- Defined in:
- lib/bitfield_attribute/base.rb
Instance Method Summary collapse
Instance Method Details
#define_bits(*keys) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/bitfield_attribute/base.rb', line 12 def define_bits(*keys) if @keys.present? raise ArgumentError, 'Define all your bits with a single #define_bits statement' end @keys = keys.map(&:to_sym) if @keys.uniq.size != @keys.size raise ArgumentError, "Bit names are not uniq" end if @keys.size > INTEGER_SIZE raise ArgumentError, "Too many bit names for #{INTEGER_SIZE}-bit integer" end define_bit_methods end |
#keys ⇒ Object
30 31 32 |
# File 'lib/bitfield_attribute/base.rb', line 30 def keys @keys end |