Module: Lyra::StrictDataAccess

Defined in:
lib/lyra/strict_data_access.rb

Overview

Module that overrides callback-bypassing instance methods to raise errors when strict_data_access mode is enabled. Uses prepend to properly intercept method calls. When operations are allowed (strict mode off or bypassed), events are created to ensure the event stream captures all state changes.

Instance Method Summary collapse

Instance Method Details

#delete ⇒ Object



56
57
58
59
60
# File 'lib/lyra/strict_data_access.rb', line 56

def delete
  raise_strict_violation!(:delete)
  publish_bypass_destroy_event
  super
end

#update_column(name, value) ⇒ Object



50
51
52
53
54
# File 'lib/lyra/strict_data_access.rb', line 50

def update_column(name, value)
  raise_strict_violation!(:update_column)
  publish_bypass_update_event({ name => value })
  super
end

#update_columns(attributes) ⇒ Object



44
45
46
47
48
# File 'lib/lyra/strict_data_access.rb', line 44

def update_columns(attributes)
  raise_strict_violation!(:update_columns)
  publish_bypass_update_event(attributes)
  super
end