Class: Olyx::Guardrails::Rails::Runtime
- Inherits:
-
Object
- Object
- Olyx::Guardrails::Rails::Runtime
- Extended by:
- Forwardable
- Defined in:
- lib/olyx/guardrails/rails/runtime.rb
Overview
Owns configured Rails input, message, and completed-output operations.
Instance Method Summary collapse
- #check(input, metadata: {}) ⇒ Object
- #check_messages(messages, metadata: {}) ⇒ Object
- #check_output(output, metadata: {}) ⇒ Object
-
#initialize ⇒ Runtime
constructor
A new instance of Runtime.
- #redact(input) ⇒ Object
- #redact_output(output) ⇒ Object
Constructor Details
#initialize ⇒ Runtime
Returns a new instance of Runtime.
23 24 25 |
# File 'lib/olyx/guardrails/rails/runtime.rb', line 23 def initialize @registry = ConfigurationRegistry.new end |
Instance Method Details
#check(input, metadata: {}) ⇒ Object
27 28 29 |
# File 'lib/olyx/guardrails/rails/runtime.rb', line 27 def check(input, metadata: {}) INPUT_EVALUATION.call(input, metadata: validate(), configuration: @registry.ready) end |
#check_messages(messages, metadata: {}) ⇒ Object
35 36 37 |
# File 'lib/olyx/guardrails/rails/runtime.rb', line 35 def (, metadata: {}) MESSAGE_EVALUATION.call(, metadata: validate(), configuration: @registry.ready) end |
#check_output(output, metadata: {}) ⇒ Object
39 40 41 42 |
# File 'lib/olyx/guardrails/rails/runtime.rb', line 39 def check_output(output, metadata: {}) = { direction: 'output' }.merge(validate()) INPUT_EVALUATION.call(output, metadata: , configuration: @registry.ready) end |
#redact(input) ⇒ Object
31 32 33 |
# File 'lib/olyx/guardrails/rails/runtime.rb', line 31 def redact(input) RedactionService.call(input, configuration: @registry.ready) end |
#redact_output(output) ⇒ Object
44 45 46 |
# File 'lib/olyx/guardrails/rails/runtime.rb', line 44 def redact_output(output) RedactionService.call(output, configuration: @registry.ready) end |