Class: Aef::Hosts::Comment
Overview
Represents a comment-only line as element of a hosts file
Instance Attribute Summary (collapse)
-
- (String) comment
The comment.
Attributes inherited from Element
Instance Method Summary (collapse)
-
- (String) generate_string(options = {})
protected
Defines the algorithm to generate a String representation from scratch.
-
- (Comment) initialize(comment, options = {})
constructor
Initializes a comment.
-
- (String) inspect
A String representation for debugging purposes.
Methods inherited from Element
#cache_filled?, #cache_string, #invalidate_cache!, #to_s
Constructor Details
- (Comment) initialize(comment, options = {})
Initializes a comment
38 39 40 41 42 43 44 45 |
# File 'lib/aef/hosts/comment.rb', line 38 def initialize(comment, = {}) (, :cache) raise ArgumentError, 'Comment cannot be empty' unless comment @comment = comment.to_s @cache = [:cache].to_s unless [:cache].nil? end |
Instance Attribute Details
- (String) comment
The comment
31 32 33 |
# File 'lib/aef/hosts/comment.rb', line 31 def comment @comment end |
Instance Method Details
- (String) generate_string(options = {}) (protected)
Defines the algorithm to generate a String representation from scratch.
66 67 68 |
# File 'lib/aef/hosts/comment.rb', line 66 def generate_string( = {}) "##{comment}\n" end |
- (String) inspect
A String representation for debugging purposes
57 58 59 |
# File 'lib/aef/hosts/comment.rb', line 57 def inspect generate_inspect(self, :comment, :cache) end |