class Filewatcher::Runner

Get runner command by filename

Constants

RUNNERS

Define runners for `–exec` option

Public Class Methods

new(filename) click to toggle source
# File lib/filewatcher/runner.rb, line 16
def initialize(filename)
  @filename = filename
  @ext = File.extname(filename).delete('.')
end

Public Instance Methods

command() click to toggle source
# File lib/filewatcher/runner.rb, line 21
def command
  "env #{runner} #{@filename}" if runner
end

Private Instance Methods

runner() click to toggle source
# File lib/filewatcher/runner.rb, line 27
def runner
  return @runner if defined?(@runner)
  @runner, _exts = RUNNERS.find { |_cmd, exts| exts.include? @ext }
  @runner
end