Class: IuguLogger::Schema::Result
- Inherits:
-
Object
- Object
- IuguLogger::Schema::Result
- Defined in:
- lib/iugu_logger/schema.rb
Overview
Frozen result of a single validate call. Plain class (not Struct keyword_init: which only landed in Ruby 2.5).
Instance Attribute Summary collapse
-
#event_kind ⇒ Object
readonly
Returns the value of attribute event_kind.
-
#missing_fields ⇒ Object
readonly
Returns the value of attribute missing_fields.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#suggestions ⇒ Object
readonly
Returns the value of attribute suggestions.
Instance Method Summary collapse
-
#initialize(status:, event_kind: nil, missing_fields: [], suggestions: []) ⇒ Result
constructor
A new instance of Result.
- #missing_required? ⇒ Boolean
- #off? ⇒ Boolean
- #ok? ⇒ Boolean
- #unknown_action? ⇒ Boolean
Constructor Details
#initialize(status:, event_kind: nil, missing_fields: [], suggestions: []) ⇒ Result
Returns a new instance of Result.
43 44 45 46 47 48 49 |
# File 'lib/iugu_logger/schema.rb', line 43 def initialize(status:, event_kind: nil, missing_fields: [], suggestions: []) @status = status @event_kind = event_kind @missing_fields = missing_fields @suggestions = suggestions freeze end |
Instance Attribute Details
#event_kind ⇒ Object (readonly)
Returns the value of attribute event_kind.
41 42 43 |
# File 'lib/iugu_logger/schema.rb', line 41 def event_kind @event_kind end |
#missing_fields ⇒ Object (readonly)
Returns the value of attribute missing_fields.
41 42 43 |
# File 'lib/iugu_logger/schema.rb', line 41 def missing_fields @missing_fields end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
41 42 43 |
# File 'lib/iugu_logger/schema.rb', line 41 def status @status end |
#suggestions ⇒ Object (readonly)
Returns the value of attribute suggestions.
41 42 43 |
# File 'lib/iugu_logger/schema.rb', line 41 def suggestions @suggestions end |
Instance Method Details
#missing_required? ⇒ Boolean
54 |
# File 'lib/iugu_logger/schema.rb', line 54 def missing_required?; status == :missing_required; end |
#off? ⇒ Boolean
52 |
# File 'lib/iugu_logger/schema.rb', line 52 def off?; status == :off; end |
#ok? ⇒ Boolean
51 |
# File 'lib/iugu_logger/schema.rb', line 51 def ok?; status == :ok; end |
#unknown_action? ⇒ Boolean
53 |
# File 'lib/iugu_logger/schema.rb', line 53 def unknown_action?; status == :unknown_action; end |