Class: Sheetah::Messaging::Message
- Inherits:
-
Object
- Object
- Sheetah::Messaging::Message
- Includes:
- Validations
- Defined in:
- lib/sheetah/messaging/message.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#code_data ⇒ Object
Returns the value of attribute code_data.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#scope_data ⇒ Object
Returns the value of attribute scope_data.
-
#severity ⇒ Object
Returns the value of attribute severity.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(code:, code_data: nil, scope: SCOPES::SHEET, scope_data: nil, severity: SEVERITIES::WARN) ⇒ Message
constructor
A new instance of Message.
- #to_h ⇒ Object
- #to_s ⇒ Object
Methods included from Validations
Constructor Details
#initialize(code:, code_data: nil, scope: SCOPES::SHEET, scope_data: nil, severity: SEVERITIES::WARN) ⇒ Message
Returns a new instance of Message.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sheetah/messaging/message.rb', line 11 def initialize( code:, code_data: nil, scope: SCOPES::SHEET, scope_data: nil, severity: SEVERITIES::WARN ) @code = code @code_data = code_data @scope = scope @scope_data = scope_data @severity = severity end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
25 26 27 |
# File 'lib/sheetah/messaging/message.rb', line 25 def code @code end |
#code_data ⇒ Object
Returns the value of attribute code_data.
25 26 27 |
# File 'lib/sheetah/messaging/message.rb', line 25 def code_data @code_data end |
#scope ⇒ Object
Returns the value of attribute scope.
25 26 27 |
# File 'lib/sheetah/messaging/message.rb', line 25 def scope @scope end |
#scope_data ⇒ Object
Returns the value of attribute scope_data.
25 26 27 |
# File 'lib/sheetah/messaging/message.rb', line 25 def scope_data @scope_data end |
#severity ⇒ Object
Returns the value of attribute severity.
25 26 27 |
# File 'lib/sheetah/messaging/message.rb', line 25 def severity @severity end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/sheetah/messaging/message.rb', line 33 def ==(other) other.is_a?(self.class) && code == other.code && code_data == other.code_data && scope == other.scope && scope_data == other.scope_data && severity == other.severity end |
#to_h ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/sheetah/messaging/message.rb', line 48 def to_h { code: code, code_data: code_data, scope: scope, scope_data: scope_data, severity: severity, } end |
#to_s ⇒ Object
42 43 44 45 46 |
# File 'lib/sheetah/messaging/message.rb', line 42 def to_s parts = [scoping_to_s, "#{severity}: #{code}", code_data] parts.compact! parts.join(" ") end |