Class: IuguLogger::Schema::Result

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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_kindObject (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_fieldsObject (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

#statusObject (readonly)

Returns the value of attribute status.



41
42
43
# File 'lib/iugu_logger/schema.rb', line 41

def status
  @status
end

#suggestionsObject (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

Returns:

  • (Boolean)


54
# File 'lib/iugu_logger/schema.rb', line 54

def missing_required?; status == :missing_required; end

#off?Boolean

Returns:

  • (Boolean)


52
# File 'lib/iugu_logger/schema.rb', line 52

def off?;              status == :off;               end

#ok?Boolean

Returns:

  • (Boolean)


51
# File 'lib/iugu_logger/schema.rb', line 51

def ok?;               status == :ok;                end

#unknown_action?Boolean

Returns:

  • (Boolean)


53
# File 'lib/iugu_logger/schema.rb', line 53

def unknown_action?;   status == :unknown_action;    end