Sha256: 8d6460226d160eb852831462fc7e4bb0454e37bdb5264c0b62408782ac4da039

Contents?: true

Size: 499 Bytes

Versions: 1

Compression:

Stored size: 499 Bytes

Contents

require 'dev_scripts/script'
require 'dev_scripts/support/block_expander'

DevScripts::Script.define_script :expand_block do
  args :file_path, :line_number

  execute do
    lines = []

    File.foreach(file_path).with_index do |file_line, index|
      if index + 1 == line_number.to_i
        lines << DevScripts::Support::BlockExpander.new(line: file_line).run
      else
        lines << file_line
      end
    end

    File.open(file_path, 'w') { |file| file.write(lines.join('')) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dev_scripts-0.1.6 lib/dev_scripts/scripts/expand_block.rb