Class: Cline::FileContent
- Inherits:
-
Object
- Object
- Cline::FileContent
- Includes:
- Serializable::File
- Defined in:
- lib/cline/file_content.rb
Overview
Store a file's content, either from an existing file or just in memory for later persistence.
Instance Attribute Summary
Attributes included from Serializable::File
Public API collapse
-
#==(other) ⇒ Boolean
Equality check.
-
#content ⇒ String
Retrieve the file's content.
-
#initialize(content = nil) ⇒ FileContent
constructor
Constructor.
Methods included from Serializable::File
included, #initialize_from_file
Constructor Details
#initialize(content = nil) ⇒ FileContent
Constructor
29 30 31 |
# File 'lib/cline/file_content.rb', line 29 def initialize(content = nil) @content = content end |
Instance Method Details
#==(other) ⇒ Boolean
Equality check
17 18 19 20 |
# File 'lib/cline/file_content.rb', line 17 def ==(other) other.is_a?(FileContent) && other.content == content end |
#content ⇒ String
Retrieve the file's content
9 10 11 |
# File 'lib/cline/file_content.rb', line 9 def content @content ||= File.read(file) end |