Class: Sed::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/sed/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_file_path, opts = {}, &blk) ⇒ Runner

Returns a new instance of Runner.



6
7
8
9
10
11
# File 'lib/sed/runner.rb', line 6

def initialize(input_file_path, opts = {}, &blk)
  @input_file_path = input_file_path
  @opts = opts

  instance_eval(&blk) if block_given?
end

Instance Attribute Details

#input_file_pathObject (readonly)

Returns the value of attribute input_file_path.



4
5
6
# File 'lib/sed/runner.rb', line 4

def input_file_path
  @input_file_path
end

#optsObject (readonly)

Returns the value of attribute opts.



4
5
6
# File 'lib/sed/runner.rb', line 4

def opts
  @opts
end

Instance Method Details

#replace(expression, replacement) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/sed/runner.rb', line 13

def replace(expression, replacement)
  Sed::Commander.replace(
    input_file_path, 
    expression,
    replacement,
    opts
  )
end