Sha256: d6802c0d2ad74d609c1aa163367c432257d3bdf40fa3f687a0bd580e06b09d04
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true # Principles: # POLA # KISS # YAGNI # POLS # DEI # TDD considered harmful # TGCB module ActWithFlags module Base attr_reader :act_with_flags def add_to_flags(*flags, origin: :flags, range: nil, **hash) unless @act_with_flags @act_with_flags ||= ActWithFlags::Admin.new self @act_with_flags.add_mask_et_all origin end flags.each { |name| @act_with_flags.add_flag(name, nil, origin, range) } hash.each { |name, pos| @act_with_flags.add_flag(name, pos, origin, range) } @act_with_flags end def remove_from_flags(*flags) flags.each { |name| @act_with_flags.remove_accessor(name) } end def clear_flags_at_save(*flags) @act_with_flags.clear_at_save(*flags) end end end class ActiveRecord::Base extend ActWithFlags::Base end $LOAD_PATH.unshift(File.join(File.dirname(__FILE__))) require "act_with_flags/version" require "act_with_flags/utils" require "act_with_flags/define" require "act_with_flags/admin" require "act_with_flags/flags" require "act_with_flags/clear" require "act_with_flags/print"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
act_with_flags-3.1.0 | lib/act_with_flags.rb |