Class: CodeRay::Encoders::HTML::Output::Template

Inherits:
String
  • Object
show all
Defined in:
vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/output.rb

Defined Under Namespace

Modules: Simple

Class Method Summary

Instance Method Summary

Methods inherited from String

#gunzip, #gunzip!, #gzip, #gzip!, #parse_csv, #read_ber, #to_ber, #to_ber_application_string, #to_ber_contextspecific, #to_unix, #with_leading_slash

Methods included from Diffable

#diff, #patch, #replacenextlarger, #reverse_hash

Methods included from Redmine::CoreExtensions::String::Conversions

#to_a, #to_hours

Methods included from Redmine::CoreExtensions::String::Inflections

#with_leading_slash

Class Method Details

+ (Object) wrap!(str, template, target)



132
133
134
135
136
137
138
139
140
# File 'vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/output.rb', line 132

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

- (Object) apply(target, replacement)



142
143
144
145
146
147
148
149
# File 'vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/output.rb', line 142

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