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

Inherits:
String show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/lib/coderay/encoders/html/output.rb

Overview

– don’t include the templates in docu

Constant Summary

Constants inherited from String

String::BLANK_RE, String::ENCODED_BLANKS, String::ENCODING_BINARY

Constants included from Diff::LCS

Diff::LCS::BalancedCallbacks, Diff::LCS::PATCH_MAP, Diff::LCS::SequenceCallbacks, Diff::LCS::VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from String

#_blankslate_as_name, #acts_like_string?, #as_json, #at, #blank?, #camelize, #classify, #constantize, #dasherize, #deconstantize, #demodulize, #exclude?, #first, #foreign_key, #from, #html_safe, #humanize, #in_time_zone, #indent, #indent!, #inquiry, #is_utf8?, #last, #mb_chars, #parameterize, #pluralize, #remove, #remove!, #safe_constantize, #singularize, #squish, #squish!, #strip_heredoc, #tableize, #titleize, #to, #to_date, #to_datetime, #to_time, #to_xs, #truncate, #truncate_bytes, #truncate_words, #underscore, #upcase_first

Methods included from Diff::LCS

callbacks_for, #diff, diff, diff_traversal, #lcs, lcs, patch, #patch, #patch!, patch!, #patch_me, #sdiff, sdiff, #traverse_balanced, traverse_balanced, traverse_sequences, #traverse_sequences, #unpatch, #unpatch!, unpatch!, #unpatch_me

Class Method Details

.wrap!(str, template, target) ⇒ Object

:nodoc:



94
95
96
97
98
99
100
101
102
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/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