Class: YoutubeDlhelper

Inherits:
Object
  • Object
show all
Defined in:
lib/youtube_dlhelper.rb,
lib/youtube_dlhelper/change.rb

Overview

MannsShared Class

Constant Summary collapse

VERSION =
Note:

Version variable

'2.0.4'

Class Method Summary collapse

Class Method Details

.search_replace(search, replace, file) ⇒ String

Method for replacing content in a file

Parameters:

  • search (String)

    is the search text in the target file

  • replace (String)

    the replace text

  • file (String)

    Target file like Author_Group.xml

Returns:

  • (String)

    true or false



28
29
30
31
32
33
34
35
# File 'lib/youtube_dlhelper/change.rb', line 28

def self.search_replace(search, replace, file)
  text = File.read(file)
  new_value = text.gsub(search, replace)
  puts new_value
  File.open(file, 'w') do |file1|
    file1.puts new_value
  end
end