Commit e68b7da9 authored by Daniel Gerhardt's avatar Daniel Gerhardt

Restore Ruby 2.3 compatibility

* Use String#sub with RegEx instead of String#delete_prefix
parent aaf1249c
......@@ -244,7 +244,7 @@ class Environment < ActiveRecord::Base
end
def name_without_type
@name_without_type ||= name.delete_prefix("#{environment_type}/")
@name_without_type ||= name.sub(/\A#{environment_type}\//, '')
end
def deployment_platform
......
......@@ -32,7 +32,7 @@ module Banzai
modified_footnotes = {}
doc.css('sup > a[id]').each do |link_node|
ref_num = link_node[:id].delete_prefix(FOOTNOTE_LINK_ID_PREFIX)
ref_num = link_node[:id].sub(/\A#{FOOTNOTE_LINK_ID_PREFIX}/, '')
footnote_node = doc.at_css("li[id=#{fn_id(ref_num)}]")
if INTEGER_PATTERN.match(ref_num) && (footnote_node || modified_footnotes[ref_num])
......
......@@ -41,7 +41,7 @@ describe Banzai::Filter::FootnoteFilter do
context 'when footnotes exist' do
let(:doc) { filter(footnote) }
let(:link_node) { doc.css('sup > a').first }
let(:identifier) { link_node[:id].delete_prefix('fnref1-') }
let(:identifier) { link_node[:id].sub(/\Afnref1-/, '') }
it 'properly adds the necessary ids and classes' do
expect(doc.to_html).to eq filtered_footnote
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment