Module: Easyop::Plugins::Recording::ClassMethods
- Defined in:
- lib/easyop/plugins/recording.rb
Instance Method Summary collapse
- #_recording_enabled? ⇒ Boolean
-
#_recording_filter_keys ⇒ Object
Returns the merged filter list: parent class keys + this class’s own keys.
- #_recording_model ⇒ Object
- #_recording_record_params_config ⇒ Object
- #_recording_record_result_config ⇒ Object
-
#filter_params(*keys) ⇒ Object
DSL to declare additional keys/patterns to filter in params_data.
-
#record_params(value = nil, attrs: nil, &block) ⇒ Object
DSL for controlling params capture.
-
#record_result(value = nil, attrs: nil, &block) ⇒ Object
DSL for capturing result data after the operation runs.
-
#recording(enabled) ⇒ Object
Disable recording for this class: ‘recording false`.
Instance Method Details
#_recording_enabled? ⇒ Boolean
78 79 80 81 |
# File 'lib/easyop/plugins/recording.rb', line 78 def _recording_enabled? return @_recording_enabled if instance_variable_defined?(:@_recording_enabled) superclass.respond_to?(:_recording_enabled?) ? superclass._recording_enabled? : true end |
#_recording_filter_keys ⇒ Object
Returns the merged filter list: parent class keys + this class’s own keys. Does NOT include FILTERED_KEYS or the global config list — those are merged at persist time so they stay hot-reloadable.
159 160 161 162 |
# File 'lib/easyop/plugins/recording.rb', line 159 def _recording_filter_keys parent = superclass.respond_to?(:_recording_filter_keys) ? superclass._recording_filter_keys : [] parent + _own_recording_filter_keys end |
#_recording_model ⇒ Object
83 84 85 86 |
# File 'lib/easyop/plugins/recording.rb', line 83 def _recording_model @_recording_model || (superclass.respond_to?(:_recording_model) ? superclass._recording_model : nil) end |
#_recording_record_params_config ⇒ Object
106 107 108 109 110 111 112 113 114 |
# File 'lib/easyop/plugins/recording.rb', line 106 def _recording_record_params_config if instance_variable_defined?(:@_recording_record_params) @_recording_record_params elsif superclass.respond_to?(:_recording_record_params_config) superclass._recording_record_params_config else true end end |
#_recording_record_result_config ⇒ Object
133 134 135 136 137 138 139 140 141 |
# File 'lib/easyop/plugins/recording.rb', line 133 def _recording_record_result_config if instance_variable_defined?(:@_recording_record_result) @_recording_record_result elsif superclass.respond_to?(:_recording_record_result_config) superclass._recording_record_result_config else false end end |
#filter_params(*keys) ⇒ Object
DSL to declare additional keys/patterns to filter in params_data. Accepts Symbol, String, or Regexp. Additive with FILTERED_KEYS and any filter_keys declared on parent classes or at the plugin install level. Matched keys are kept in params_data but their value is replaced with “[FILTERED]”.
152 153 154 |
# File 'lib/easyop/plugins/recording.rb', line 152 def filter_params(*keys) @_recording_filter_keys = _own_recording_filter_keys + keys end |
#record_params(value = nil, attrs: nil, &block) ⇒ Object
DSL for controlling params capture. Forms:
record_params false # disable params recording entirely
record_params true # explicit full ctx (default)
record_params attrs: :key # selective keys
record_params { |ctx| {...} } # block
record_params :build_params # private method name
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/easyop/plugins/recording.rb', line 94 def record_params(value = nil, attrs: nil, &block) @_recording_record_params = if block block elsif attrs { attrs: attrs } elsif !value.nil? value else true end end |
#record_result(value = nil, attrs: nil, &block) ⇒ Object
DSL for capturing result data after the operation runs. Forms:
record_result true # full ctx snapshot (FILTERED_KEYS applied)
record_result attrs: :key # one or more ctx keys
record_result { |ctx| {...} } # block
record_result :build_result # private instance method name
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/easyop/plugins/recording.rb', line 121 def record_result(value = nil, attrs: nil, &block) @_recording_record_result = if block block elsif attrs { attrs: attrs } elsif !value.nil? value else nil end end |
#recording(enabled) ⇒ Object
Disable recording for this class: ‘recording false`
74 75 76 |
# File 'lib/easyop/plugins/recording.rb', line 74 def recording(enabled) @_recording_enabled = enabled end |