module Skr::Concerns::LockedFields::InstanceMethods

Public Instance Methods

unlock_fields( *flds ) { || ... } click to toggle source

Unlock the field for updates inside the block yields, then restores it. Is class wide, meaning it Will temporarily open all instances of the class up for access in a threaded environment

# File lib/skr/concerns/locked_fields.rb, line 68
def unlock_fields( *flds, &block )
    attr_syms = flds.map(&:to_s)

    self.class.attr_readonly.subtract( attr_syms )

    yield

    attr_syms.each do | fld |
        self.class.attr_readonly.add( fld )
    end

end