Module: CodeownerValidator::Group::Comment
- Defined in:
- lib/codeowner_validator/group/comment.rb,
lib/codeowner_validator/group/comment/info.rb,
lib/codeowner_validator/group/comment/warn.rb,
lib/codeowner_validator/group/comment/error.rb,
lib/codeowner_validator/group/comment/verbose.rb
Overview
Public: Object for storing base comment information that can be rendered appropriately by the consumer
Defined Under Namespace
Classes: Error, Info, Verbose, Warn
Constant Summary collapse
- TYPE_VERBOSE =
1
- TYPE_INFO =
2
- TYPE_WARN =
3
- TYPE_ERROR =
4
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#parent ⇒ Object
to keep track of hierarchical structure of comments and allow grouping.
Class Method Summary collapse
-
.build(comment:, type: TYPE_INFO, **_args) ⇒ Info|
Public: Creates an instance of the comment for usage.
-
.match?(type) ⇒ Boolean
Public: Returns <true> if the type of object requested is supported by the object; otherwise, <false>.
Instance Method Summary collapse
-
#initialize(comment) ⇒ Object
Public: Creates an instance of the comment.
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
14 15 16 |
# File 'lib/codeowner_validator/group/comment.rb', line 14 def comment @comment end |
#parent ⇒ Object
to keep track of hierarchical structure of comments and allow grouping
13 14 15 |
# File 'lib/codeowner_validator/group/comment.rb', line 13 def parent @parent end |
Class Method Details
.build(comment:, type: TYPE_INFO, **_args) ⇒ Info|
Public: Creates an instance of the comment for usage.
24 25 26 27 28 29 |
# File 'lib/codeowner_validator/group/comment.rb', line 24 def build(comment:, type: TYPE_INFO, **_args) subclasses.each do |klass| return klass.new(comment) if klass.match?(type) end raise "Type '#{type}' not supported" # rubocop:disable Style/ImplicitRuntimeError end |
.match?(type) ⇒ Boolean
Public: Returns <true> if the type of object requested is supported by the object; otherwise, <false>
34 |
# File 'lib/codeowner_validator/group/comment.rb', line 34 def match?(type); end |
Instance Method Details
#initialize(comment) ⇒ Object
Public: Creates an instance of the comment
47 48 49 |
# File 'lib/codeowner_validator/group/comment.rb', line 47 def initialize(comment) @comment = comment end |