module ActiveRecord::Base
Principles:
POLA KISS YAGNI POLS DEI TDD considered harmful
Attributes
act_with_flags[RW]
Public Class Methods
add_to_flags(*flags, origin: :flags, **hash)
click to toggle source
# File lib/act_with_flags.rb, line 16 def add_to_flags(*flags, origin: :flags, **hash) #p "act_with_flags: add_to_flags #{flags.inspect}" #p "act_with_flags: origin #{origin.inspect}" #p "act_with_flags: hash #{hash.inspect}" @act_with_flags ||= ActWithFlags::Admin.new self if origin.is_a?(Integer) hash[:origin] = origin else @act_with_flags.origin = origin @act_with_flags.delete_mask_et_all @act_with_flags.add_mask_et_all origin end flags.each { |name| @act_with_flags.add_accessor(name, nil) } hash.each { |name, pos| @act_with_flags.add_accessor(name, pos) } @act_with_flags end
clear_flags_at_save(*flags)
click to toggle source
# File lib/act_with_flags.rb, line 41 def clear_flags_at_save(*flags) #p "clear_flags_at_save #{flags.inspect}" flags.each { |name| @act_with_flags.add_to_delete_mask(name) } @act_with_flags.before_save end
remove_from_flags(*flags)
click to toggle source
# File lib/act_with_flags.rb, line 36 def remove_from_flags(*flags) #p "remove_from_flags #{flags.inspect}" flags.each { |name| @act_with_flags.remove_accessor(name) } end