Class: AIHype::ApprovalPrompt
- Inherits:
-
Object
- Object
- AIHype::ApprovalPrompt
- Defined in:
- lib/aihype/approval_prompt.rb
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#decision ⇒ Object
readonly
Returns the value of attribute decision.
-
#detected_patterns ⇒ Object
readonly
Returns the value of attribute detected_patterns.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_menu ⇒ Object
readonly
Returns the value of attribute is_menu.
-
#matched_rule ⇒ Object
readonly
Returns the value of attribute matched_rule.
-
#raw_text ⇒ Object
readonly
Returns the value of attribute raw_text.
-
#response_sent ⇒ Object
readonly
Returns the value of attribute response_sent.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #ai_unavailable_approve!(response = nil) ⇒ Object
- #approve!(response = nil) ⇒ Object
- #approved? ⇒ Boolean
- #denied? ⇒ Boolean
- #deny!(rule_id, response = nil) ⇒ Object
-
#initialize(id:, raw_text:, detected_patterns: [], confidence: 0.0, is_menu: false) ⇒ ApprovalPrompt
constructor
A new instance of ApprovalPrompt.
Constructor Details
#initialize(id:, raw_text:, detected_patterns: [], confidence: 0.0, is_menu: false) ⇒ ApprovalPrompt
Returns a new instance of ApprovalPrompt.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/aihype/approval_prompt.rb', line 7 def initialize(id:, raw_text:, detected_patterns: [], confidence: 0.0, is_menu: false) @id = id @timestamp = Time.now @raw_text = raw_text @detected_patterns = detected_patterns @confidence = confidence @matched_rule = nil @decision = :pending @response_sent = nil @is_menu = end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def confidence @confidence end |
#decision ⇒ Object (readonly)
Returns the value of attribute decision.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def decision @decision end |
#detected_patterns ⇒ Object (readonly)
Returns the value of attribute detected_patterns.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def detected_patterns @detected_patterns end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def id @id end |
#is_menu ⇒ Object (readonly)
Returns the value of attribute is_menu.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def @is_menu end |
#matched_rule ⇒ Object (readonly)
Returns the value of attribute matched_rule.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def matched_rule @matched_rule end |
#raw_text ⇒ Object (readonly)
Returns the value of attribute raw_text.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def raw_text @raw_text end |
#response_sent ⇒ Object (readonly)
Returns the value of attribute response_sent.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def response_sent @response_sent end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/aihype/approval_prompt.rb', line 5 def @timestamp end |
Instance Method Details
#ai_unavailable_approve!(response = nil) ⇒ Object
30 31 32 33 |
# File 'lib/aihype/approval_prompt.rb', line 30 def ai_unavailable_approve!(response = nil) @decision = :ai_unavailable_approved @response_sent = response || default_approve_response end |
#approve!(response = nil) ⇒ Object
19 20 21 22 |
# File 'lib/aihype/approval_prompt.rb', line 19 def approve!(response = nil) @decision = :approved @response_sent = response || default_approve_response end |
#approved? ⇒ Boolean
35 36 37 |
# File 'lib/aihype/approval_prompt.rb', line 35 def approved? @decision == :approved || @decision == :ai_unavailable_approved end |
#denied? ⇒ Boolean
39 40 41 |
# File 'lib/aihype/approval_prompt.rb', line 39 def denied? @decision == :denied end |
#deny!(rule_id, response = nil) ⇒ Object
24 25 26 27 28 |
# File 'lib/aihype/approval_prompt.rb', line 24 def deny!(rule_id, response = nil) @decision = :denied @matched_rule = rule_id @response_sent = response || default_deny_response end |