Class: Elisp2any::Comment
- Inherits:
-
Object
- Object
- Elisp2any::Comment
- Defined in:
- lib/elisp2any/comment.rb
Instance Attribute Summary collapse
-
#colons ⇒ Object
readonly
Returns the value of attribute colons.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#padding ⇒ Object
readonly
Returns the value of attribute padding.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(colons:, content:, padding:) ⇒ Comment
constructor
A new instance of Comment.
Constructor Details
#initialize(colons:, content:, padding:) ⇒ Comment
13 14 15 16 17 |
# File 'lib/elisp2any/comment.rb', line 13 def initialize(colons:, content:, padding:) @colons = colons @content = content @padding = padding end |
Instance Attribute Details
#colons ⇒ Object (readonly)
Returns the value of attribute colons.
3 4 5 |
# File 'lib/elisp2any/comment.rb', line 3 def colons @colons end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
3 4 5 |
# File 'lib/elisp2any/comment.rb', line 3 def content @content end |
#padding ⇒ Object (readonly)
Returns the value of attribute padding.
3 4 5 |
# File 'lib/elisp2any/comment.rb', line 3 def padding @padding end |
Class Method Details
.scan(scanner) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/elisp2any/comment.rb', line 5 def self.scan(scanner) scanner = StringScanner.new(scanner) unless scanner.respond_to?(:skip) scanner.skip(/(?<colons>;+)(?<padding> *)(?<content>.*)\n?/) or return new(colons: scanner[:colons].size, content: scanner[:content], padding: scanner[:padding]) end |