Class: Nanoc::Core::TextualContent
- Inherits:
-
Content
- Object
- Content
- Nanoc::Core::TextualContent
show all
- Defined in:
- lib/nanoc/core/textual_content.rb
Instance Attribute Summary
Attributes inherited from Content
#filename
Instance Method Summary
collapse
Methods inherited from Content
create, #textual?
enabled?, included, setup_once, warn_about_performance
Constructor Details
#initialize(string, filename: nil) ⇒ TextualContent
Returns a new instance of TextualContent.
10
11
12
13
|
# File 'lib/nanoc/core/textual_content.rb', line 10
def initialize(string, filename: nil)
super(filename)
@string = Nanoc::Core::LazyValue.new(string)
end
|
Instance Method Details
#binary? ⇒ Boolean
28
29
30
|
# File 'lib/nanoc/core/textual_content.rb', line 28
def binary?
false
end
|
#freeze ⇒ Object
21
22
23
24
25
|
# File 'lib/nanoc/core/textual_content.rb', line 21
def freeze
super
@string.freeze
self
end
|
#marshal_dump ⇒ Object
33
34
35
|
# File 'lib/nanoc/core/textual_content.rb', line 33
def marshal_dump
[filename, string]
end
|
#marshal_load(array) ⇒ Object
38
39
40
41
|
# File 'lib/nanoc/core/textual_content.rb', line 38
def marshal_load(array)
@filename = array[0]
@string = Nanoc::Core::LazyValue.new(array[1])
end
|
#string ⇒ Object
16
17
18
|
# File 'lib/nanoc/core/textual_content.rb', line 16
def string
@string.value
end
|