class PryBeGone
require “prybegone/version”
Public Class Methods
this_file()
click to toggle source
# File lib/prybegone.rb, line 20 def self.this_file Dir.pwd end
Public Instance Methods
run()
click to toggle source
# File lib/prybegone.rb, line 24 def run if @@input_flag.include?("-co") self.search_and_change("binding.pry", "#binding.pry") elsif @@input_flag.include?("-r") self.search_and_change("binding.pry", "") elsif @@input_flag.include?("-ci") self.search_and_change("#binding.pry", "binding.pry") self.search_and_change("\n#binding.pry", "\nbinding.pry") end end
search_and_change(arg1, arg2)
click to toggle source
# File lib/prybegone.rb, line 7 def search_and_change(arg1, arg2) @curr_dir = Dir.pwd Dir.glob("#@curr_dir/**.rb").each do |file| unless file.include? "prybegone.rb" text = File.read(file) content = text.gsub("#{arg1}", "#{arg2}") File.open(file, "w") { |file| file << content } end end end