Module: JekyllBeginEnd

Defined in:
lib/jekyll_begin_end.rb

Overview

Jekyll filters for working with strings.

Instance Method Summary collapse

Instance Method Details

#append_suffix_if_does_not_start_with(text, query, suffix) ⇒ Object



10
11
12
# File 'lib/jekyll_begin_end.rb', line 10

def append_suffix_if_does_not_start_with(text, query, suffix)
  text.start_with?(query) ? text : "#{text}#{suffix}"
end

#begins_with(text, query) ⇒ Object



14
15
16
# File 'lib/jekyll_begin_end.rb', line 14

def begins_with(text, query)
  text.start_with? query
end

#does_not_begin_with(text, query) ⇒ Object



18
19
20
# File 'lib/jekyll_begin_end.rb', line 18

def does_not_begin_with(text, query)
  !text.start_with? query
end

#does_not_end_with(text, query) ⇒ Object



22
23
24
# File 'lib/jekyll_begin_end.rb', line 22

def does_not_end_with(text, query)
  !text.end_with? query
end

#ends_with(text, query) ⇒ Object



26
27
28
# File 'lib/jekyll_begin_end.rb', line 26

def ends_with(text, query)
  text.end_with? query
end