Class: Rails5XHRUpdate::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/rails5_xhr_update/cli.rb

Overview

Provide the entry point to this program.

Instance Method Summary collapse

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rails5_xhr_update/cli.rb', line 8

def run
  parse_options
  filenames.each do |path|
    buffer = Parser::Source::Buffer.new(path)
    buffer.read
    new_source = XHRToRails5.new.rewrite(
      buffer, Parser::CurrentRuby.new.parse(buffer)
    )
    output(new_source, path)
  end
  0
end