Class: PryMeARiver
- Inherits:
-
Object
- Object
- PryMeARiver
- Defined in:
- lib/pmar.rb
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
14 15 16 17 |
# File 'lib/pmar.rb', line 14 def run self.search_and_change("binding.pry ", "#binding.pry ") self.search_and_change("\nbinding.pry", "\n#binding.pry") end |
#search_and_change(arg1, arg2) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/pmar.rb', line 4 def search_and_change(arg1, arg2) Dir.glob('../**/**.rb').each do |file| unless file.include?('pmar/lib/pmar') original_text = File.read(file) new_text = original_text.gsub("#{arg1}", "#{arg2}") File.open(file, "w") { |file| file << new_text } end end end |