module Fluent
  class ScriptFilter < Filter
    Plugin.register_filter('script', self)

    config_param :path, :string

    def configure(conf)
      super
      load_script_file(conf['path'].to_s)
    end

    def load_script_file(path)
      raise ConfigError, "Ruby script file does not exist: #{path}" unless File.exist?(path)
      eval "self.instance_eval do;" + IO.read(path) + ";end"
    end
  end
end


module Fluent
  class ScriptFilter < Filter
    Plugin.register_filter('script', self)

    config_param :path, :string

    def configure(conf)
      super
      load_script_file(conf['path'].to_s)
    end

    def load_script_file(path)
      raise ConfigError, "Ruby script file does not exist: #{path}" unless File.exist?(path)
      eval "self.instance_eval do;" + IO.read(path) + ";\nend"
    end
  end
end


Fix eval issue if file ends in a comment
Fix eval issue if file ends in a comment
