class Shark::Permissions::Changes
Attributes
effect[R]
privileges[R]
Public Class Methods
new()
click to toggle source
# File lib/shark/permissions/changes.rb, line 9 def initialize @privileges = {} @effect = {} end
Public Instance Methods
add(field, old_value, new_value)
click to toggle source
# File lib/shark/permissions/changes.rb, line 14 def add(field, old_value, new_value) return if old_value == new_value instance_variable_set("@#{field}", { old: old_value, new: old_value }) end
add_privilege(key, old_value, new_value)
click to toggle source
# File lib/shark/permissions/changes.rb, line 20 def add_privilege(key, old_value, new_value) @privileges[:old] ||= {} @privileges[:new] ||= {} @privileges[:old][key] = old_value @privileges[:new][key] = new_value end
empty?()
click to toggle source
@return [Boolean] @api public
# File lib/shark/permissions/changes.rb, line 29 def empty? effect.empty? && privileges.empty? end
present?()
click to toggle source
@return [Boolean] @api public
# File lib/shark/permissions/changes.rb, line 35 def present? !empty? end