Class: Simple::Service::Action::Comment
- Inherits:
-
Object
- Object
- Simple::Service::Action::Comment
- Defined in:
- lib/simple/service/action/comment.rb
Overview
returns the comment for an action
Defined Under Namespace
Modules: Extractor
Instance Attribute Summary collapse
-
#full ⇒ Object
readonly
Returns the value of attribute full.
- #short ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(short:, full:) ⇒ Comment
constructor
A new instance of Comment.
Constructor Details
#initialize(short:, full:) ⇒ Comment
Returns a new instance of Comment.
13 14 15 |
# File 'lib/simple/service/action/comment.rb', line 13 def initialize(short:, full:) @short, @full = short, full end |
Instance Attribute Details
#full ⇒ Object (readonly)
Returns the value of attribute full.
4 5 6 |
# File 'lib/simple/service/action/comment.rb', line 4 def full @full end |
#short ⇒ Object (readonly)
3 4 5 |
# File 'lib/simple/service/action/comment.rb', line 3 def short @short end |
Class Method Details
.extract(action:) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/simple/service/action/comment.rb', line 6 def self.extract(action:) file, line = action.source_location lines = Extractor.extract_comment_lines(file: file, before_line: line) full = lines[2..].join("\n") if lines.length >= 2 new short: lines[0], full: full end |