class Rmline::Rmline
Public Class Methods
new()
click to toggle source
# File lib/rmline.rb, line 6 def initialize @temp_file = Tempfile.new('tmp') @input = IO.read(ARGV[0]) self.input_to_tempfile self.remove_line end
Public Instance Methods
input_to_tempfile()
click to toggle source
# File lib/rmline.rb, line 14 def input_to_tempfile @temp_file << @input @temp_file.rewind end
remove_line()
click to toggle source
# File lib/rmline.rb, line 20 def remove_line File.delete(ARGV[0]) File.open(ARGV[0], "a") do |out| @temp_file.read.each_line do |current_line| if current_line.match(ARGV[1]) part_line = current_line.partition(ARGV[1]).first.strip out.puts part_line else out.puts(current_line) end end end puts <<-MESSAGE ! ! ATTENTION ! ! Rmline is deprecated and has been renamed to partline ! Please use partline instead ! https://github.com/jameslwren/partline ! MESSAGE # puts "rmline is deprecated and has been renamed to partline" # puts "please use partline instead" end