Class: WarningSigns::Behavior::Base
- Inherits:
-
Object
- Object
- WarningSigns::Behavior::Base
- Defined in:
- lib/warning_signs/behavior/base.rb
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#message_formatter ⇒ Object
readonly
Returns the value of attribute message_formatter.
Class Method Summary collapse
Instance Method Summary collapse
- #emit ⇒ Object
- #formatted_message ⇒ Object
-
#initialize(message, backtrace, message_formatter) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(message, backtrace, message_formatter) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 |
# File 'lib/warning_signs/behavior/base.rb', line 11 def initialize(, backtrace, ) @message = @backtrace = backtrace @message_formatter = end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
4 5 6 |
# File 'lib/warning_signs/behavior/base.rb', line 4 def backtrace @backtrace end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/warning_signs/behavior/base.rb', line 4 def @message end |
#message_formatter ⇒ Object (readonly)
Returns the value of attribute message_formatter.
4 5 6 |
# File 'lib/warning_signs/behavior/base.rb', line 4 def @message_formatter end |
Class Method Details
.for(behavior_type, *args) ⇒ Object
6 7 8 9 |
# File 'lib/warning_signs/behavior/base.rb', line 6 def self.for(behavior_type, *args) class_name = "WarningSigns::Behavior::#{behavior_type.classify}" class_name.constantize.new(*args) end |
Instance Method Details
#emit ⇒ Object
23 24 25 |
# File 'lib/warning_signs/behavior/base.rb', line 23 def emit raise NotImplementedError end |
#formatted_message ⇒ Object
17 18 19 20 21 |
# File 'lib/warning_signs/behavior/base.rb', line 17 def result = .(, backtrace) result = [result] unless result.is_a?(Array) result end |