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:
96 97 98 99 100 101 102 103 104 |
# File 'lib/coderay/encoders/html/output.rb', line 96 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
106 107 108 109 110 111 112 113 |
# File 'lib/coderay/encoders/html/output.rb', line 106 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 |