Class: Sheetah::Messaging::Message
- Inherits:
-
Object
- Object
- Sheetah::Messaging::Message
- Defined in:
- lib/sheetah/messaging.rb
Overview
TODO: list all possible message code in a systematic way, so that i18n do not miss any by mistake.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#code_data ⇒ Object
readonly
Returns the value of attribute code_data.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#scope_data ⇒ Object
readonly
Returns the value of attribute scope_data.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(code:, code_data: nil, scope: nil, scope_data: nil, severity: nil) ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object
Constructor Details
#initialize(code:, code_data: nil, scope: nil, scope_data: nil, severity: nil) ⇒ Message
Returns a new instance of Message.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sheetah/messaging.rb', line 20 def initialize( code:, code_data: nil, scope: nil, scope_data: nil, severity: nil ) @code = code @code_data = code_data || nil @scope = scope || SCOPES::SHEET @scope_data = scope_data || nil @severity = severity || SEVERITIES::WARN end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
34 35 36 |
# File 'lib/sheetah/messaging.rb', line 34 def code @code end |
#code_data ⇒ Object (readonly)
Returns the value of attribute code_data.
34 35 36 |
# File 'lib/sheetah/messaging.rb', line 34 def code_data @code_data end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
34 35 36 |
# File 'lib/sheetah/messaging.rb', line 34 def scope @scope end |
#scope_data ⇒ Object (readonly)
Returns the value of attribute scope_data.
34 35 36 |
# File 'lib/sheetah/messaging.rb', line 34 def scope_data @scope_data end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
34 35 36 |
# File 'lib/sheetah/messaging.rb', line 34 def severity @severity end |
Instance Method Details
#==(other) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/sheetah/messaging.rb', line 42 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_s ⇒ Object
51 52 53 54 55 |
# File 'lib/sheetah/messaging.rb', line 51 def to_s parts = [scoping_to_s, "#{severity}: #{code}", code_data] parts.compact! parts.join(" ") end |