Module: SimpleFlaggableColumn
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/simple_flaggable_column.rb,
lib/simple_flaggable_column/version.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
Class Method Details
.flags_to_symbols(flags, symbols_flags) ⇒ Object
11 12 13 |
# File 'lib/simple_flaggable_column.rb', line 11 def self.flags_to_symbols(flags, symbols_flags) symbols_flags.each_pair.inject([]){|all, v| (flags & v[1] != 0) ? (all << v[0]) : all} end |
.symbols_to_flags(symbols, symbols_flags) ⇒ Object
7 8 9 |
# File 'lib/simple_flaggable_column.rb', line 7 def self.symbols_to_flags(symbols, symbols_flags) symbols.map{|s| symbols_flags[s]}.compact.reduce(:|) || 0 end |