Module: Content
- Defined in:
- lib/jekyll_theme_marketing/content.rb
Overview
Customers module to configure jekyll’s bundle per website
Class Method Summary collapse
Class Method Details
.append(file, data) ⇒ Object
7 8 9 10 11 |
# File 'lib/jekyll_theme_marketing/content.rb', line 7 def append(file, data) File.open(file, 'a') do |f| f.write data end end |
.prepend(file, data) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jekyll_theme_marketing/content.rb', line 13 def prepend(file, data) new_content = '' File.open(file, 'r') do |f| old_content = f.read new_content = +data << old_content end File.open(file, 'w') { |f| f.write new_content } end |
.replace(file, old, new) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/jekyll_theme_marketing/content.rb', line 24 def replace(file, old, new) content = File.read(file) new_content = content.gsub(old, new) File.open(file, 'w') { |f| f.puts new_content } end |