Class: MonkeyLens::Change
- Inherits:
-
Object
- Object
- MonkeyLens::Change
- Defined in:
- lib/monkey_lens/change.rb,
sig/monkey_lens.rbs
Constant Summary collapse
- LEVELS =
{"low" => 1, "medium" => 2, "high" => 3, "critical" => 4}.freeze
Instance Attribute Summary collapse
-
#after ⇒ Object
readonly
Returns the value of attribute after.
-
#before ⇒ Object
readonly
Returns the value of attribute before.
-
#message ⇒ String
readonly
Returns the value of attribute message.
-
#method_id ⇒ String?
readonly
Returns the value of attribute method_id.
-
#severity ⇒ String
readonly
Returns the value of attribute severity.
-
#target ⇒ String
readonly
Returns the value of attribute target.
-
#type ⇒ String
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, severity:, target:, method_id: nil, before: nil, after: nil, message:) ⇒ Change
constructor
A new instance of Change.
- #level ⇒ Integer
- #to_h ⇒ Hash[String, untyped]
Constructor Details
#initialize(type:, severity:, target:, method_id: nil, before: nil, after: nil, message:) ⇒ Change
Returns a new instance of Change.
9 10 11 12 13 14 15 16 17 |
# File 'lib/monkey_lens/change.rb', line 9 def initialize(type:, severity:, target:, method_id: nil, before: nil, after: nil, message:) @type = type @severity = severity @target = target @method_id = method_id @before = before @after = after @message = end |
Instance Attribute Details
#after ⇒ Object (readonly)
Returns the value of attribute after.
7 8 9 |
# File 'lib/monkey_lens/change.rb', line 7 def after @after end |
#before ⇒ Object (readonly)
Returns the value of attribute before.
7 8 9 |
# File 'lib/monkey_lens/change.rb', line 7 def before @before end |
#message ⇒ String (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/monkey_lens/change.rb', line 7 def @message end |
#method_id ⇒ String? (readonly)
Returns the value of attribute method_id.
7 8 9 |
# File 'lib/monkey_lens/change.rb', line 7 def method_id @method_id end |
#severity ⇒ String (readonly)
Returns the value of attribute severity.
7 8 9 |
# File 'lib/monkey_lens/change.rb', line 7 def severity @severity end |
#target ⇒ String (readonly)
Returns the value of attribute target.
7 8 9 |
# File 'lib/monkey_lens/change.rb', line 7 def target @target end |
#type ⇒ String (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/monkey_lens/change.rb', line 7 def type @type end |
Instance Method Details
#level ⇒ Integer
19 20 21 |
# File 'lib/monkey_lens/change.rb', line 19 def level LEVELS.fetch(severity) end |
#to_h ⇒ Hash[String, untyped]
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/monkey_lens/change.rb', line 23 def to_h { "type" => type, "severity" => severity, "target" => target, "method" => method_id, "message" => , "before" => before, "after" => after } end |