Class: Nanoc::Int::TextualContent Private
- Defined in:
- lib/nanoc/base/entities/content.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary
Attributes inherited from Content
Instance Method Summary collapse
- #binary? ⇒ Boolean private
- #freeze ⇒ Object private
-
#initialize(string, filename: nil) ⇒ TextualContent
constructor
private
A new instance of TextualContent.
-
#marshal_dump ⇒ Object
private
TODO: Add contract.
-
#marshal_load(array) ⇒ Object
private
TODO: Add contract.
- #string ⇒ String private
Methods inherited from Content
Methods included from ContractsSupport
Constructor Details
#initialize(string, filename: nil) ⇒ TextualContent
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TextualContent.
73 74 75 76 |
# File 'lib/nanoc/base/entities/content.rb', line 73 def initialize(string, filename: nil) super(filename) @string = Nanoc::Int::LazyValue.new(string) end |
Instance Method Details
#binary? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
86 87 88 |
# File 'lib/nanoc/base/entities/content.rb', line 86 def binary? false end |
#freeze ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
79 80 81 82 83 |
# File 'lib/nanoc/base/entities/content.rb', line 79 def freeze super @string.freeze self end |
#marshal_dump ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: Add contract
91 92 93 |
# File 'lib/nanoc/base/entities/content.rb', line 91 def marshal_dump [filename, string] end |
#marshal_load(array) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: Add contract
96 97 98 99 |
# File 'lib/nanoc/base/entities/content.rb', line 96 def marshal_load(array) @filename = array[0] @string = Nanoc::Int::LazyValue.new(array[1]) end |
#string ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
68 69 70 |
# File 'lib/nanoc/base/entities/content.rb', line 68 def string @string.value end |