Class: CodeRay::Encoders::HTML::Output::Template
- Inherits:
-
String
- Object
- String
- CodeRay::Encoders::HTML::Output::Template
- Defined in:
- lib/coderay/encoders/html/output.rb
Overview
– don’t include the templates in docu
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.wrap!(str, template, target) ⇒ Object
:nodoc:
94 95 96 97 98 99 100 101 102 |
# File 'lib/coderay/encoders/html/output.rb', line 94 def self.wrap! str, template, target target = Regexp.new(Regexp.escape("<%#{target}%>")) if template =~ target str[0,0] = $` str << $' else raise "Template target <%%%p%%> not found" % target end end |
Instance Method Details
#apply(target, replacement) ⇒ Object
104 105 106 107 108 109 110 111 |
# File 'lib/coderay/encoders/html/output.rb', line 104 def apply target, replacement target = Regexp.new(Regexp.escape("<%#{target}%>")) if self =~ target Template.new($` + replacement + $') else raise "Template target <%%%p%%> not found" % target end end |