Kouhei Sutou
null+****@clear*****
Tue Jul 11 15:37:57 JST 2017
Kouhei Sutou 2017-07-11 15:37:57 +0900 (Tue, 11 Jul 2017) New Revision: 6ad3e9952eddcaa818d8f4a4dbe599e7586a6900 https://github.com/ranguba/chupa-text/commit/6ad3e9952eddcaa818d8f4a4dbe599e7586a6900 Message: Export external command path Modified files: lib/chupa-text/external-command.rb Modified: lib/chupa-text/external-command.rb (+7 -6) =================================================================== --- lib/chupa-text/external-command.rb 2017-07-11 12:02:05 +0900 (9ec7887) +++ lib/chupa-text/external-command.rb 2017-07-11 15:37:57 +0900 (b491b7c) @@ -20,8 +20,9 @@ require "pathname" module ChupaText class ExternalCommand - def initialize(command) - @command = Pathname.new(command) + attr_reader :path + def initialize(path) + @path = Pathname.new(path) end def run(*arguments) @@ -32,7 +33,7 @@ module ChupaText end spawn_options = options[:spawn_options] || {} pid = spawn(options[:env] || {}, - @command.to_s, + @path.to_s, *arguments, default_spawn_options.merge(spawn_options)) pid, status = Process.waitpid2(pid) @@ -40,11 +41,11 @@ module ChupaText end def exist? - if****@comma*****? - @command.file? and****@comma*****? + if****@path*****? + @path.file? and****@path*****? else (ENV['PATH'] || "").split(File::PATH_SEPARATOR).any? do |path| - (Pathname.new(path) + @command).expand_path.exist? + (Pathname.new(path) + @path).expand_path.exist? end end end -------------- next part -------------- HTML����������������������������...Download