Module: BulletTrain::Themes::Light::FileReplacer

Included in:
CustomThemeFileReplacer
Defined in:
lib/bullet_train/themes/light/file_replacer.rb

Class Method Summary collapse

Class Method Details

.files_have_same_content?(first_file_name, second_file_name) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/bullet_train/themes/light/file_replacer.rb', line 7

def self.files_have_same_content?(first_file_name, second_file_name)
  File.open(first_file_name).readlines == File.open(second_file_name).readlines
end

.replace_content(old:, new:) ⇒ Object

Replaces the old content with a brand new file.



12
13
14
# File 'lib/bullet_train/themes/light/file_replacer.rb', line 12

def self.replace_content(old:, new:)
  File.write(old, File.open(new).readlines.join(""))
end