Class: Jeny::File::Full
Instance Attribute Summary
Attributes inherited from Jeny::File
#config, #path
Instance Method Summary
collapse
Methods inherited from Jeny::File
#initialize, #rewrite
Constructor Details
This class inherits a constructor from Jeny::File
Instance Method Details
#context_rgx ⇒ Object
5
6
7
|
# File 'lib/jeny/file/full.rb', line 5
def context_rgx
/^#{config.jeny_block_delimiter}\((?<asset>[a-z]+)\)\s*$/
end
|
#has_jeny_context? ⇒ Boolean
9
10
11
|
# File 'lib/jeny/file/full.rb', line 9
def has_jeny_context?
path.readlines.first =~ context_rgx
end
|
#instantiate(data) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/jeny/file/full.rb', line 21
def instantiate(data)
path.readlines.map{|l|
next if l =~ context_rgx
Dialect.render(l, data) rescue l
}.compact.join("")
end
|
#instantiate_context(data) ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/jeny/file/full.rb', line 13
def instantiate_context(data)
if match = path.readlines.first.match(context_rgx)
data[match[:asset]]
else
data
end
end
|