Class: JSBeauty::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/jsbeauty/command.rb

Constant Summary collapse

PATH =
File.expand_path("../../../ext/js-beautifier/js-beautifier", __FILE__)

Instance Method Summary collapse

Constructor Details

#initialize(files, options = {}) ⇒ Command

Returns a new instance of Command.



5
6
7
8
9
10
11
12
# File 'lib/jsbeauty/command.rb', line 5

def initialize(files, options = {})
  @files = files
  @options = options

  if @files.empty?
    raise ArgumentError, "missing file"
  end
end

Instance Method Details

#runObject



14
15
16
# File 'lib/jsbeauty/command.rb', line 14

def run
  system("#{PATH} #{options_for_cmd} #{files_for_cmd}")
end