Sha256: c0cac659504889f2e76142c84dec6e99391bbfc14050aa06ce9da7165ef84c55

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

module Embulk
  module Guess

    # TODO implement guess plugin to make this command work:
    #      $ embulk guess -g "variable_length_bytes" partial-config.yml
    #
    #      Depending on the file format the plugin uses, you can use choose
    #      one of binary guess (GuessPlugin), text guess (TextGuessPlugin),
    #      or line guess (LineGuessPlugin).

    # class VariableLengthBytes < GuessPlugin
    #   Plugin.register_guess("variable_length_bytes", self)
    #
    #   def guess(config, sample_buffer)
    #     if sample_buffer[0,2] == GZIP_HEADER
    #       guessed = {}
    #       guessed["type"] = "variable_length_bytes"
    #       guessed["property1"] = "guessed-value"
    #       return {"parser" => guessed}
    #     else
    #       return {}
    #     end
    #   end
    # end

    # class VariableLengthBytes < TextGuessPlugin
    #   Plugin.register_guess("variable_length_bytes", self)
    #
    #   def guess_text(config, sample_text)
    #     js = JSON.parse(sample_text) rescue nil
    #     if js && js["mykeyword"] == "keyword"
    #       guessed = {}
    #       guessed["type"] = "variable_length_bytes"
    #       guessed["property1"] = "guessed-value"
    #       return {"parser" => guessed}
    #     else
    #       return {}
    #     end
    #   end
    # end

    # class VariableLengthBytes < LineGuessPlugin
    #   Plugin.register_guess("variable_length_bytes", self)
    #
    #   def guess_lines(config, sample_lines)
    #     all_line_matched = sample_lines.all? do |line|
    #       line =~ /mypattern/
    #     end
    #     if all_line_matched
    #       guessed = {}
    #       guessed["type"] = "variable_length_bytes"
    #       guessed["property1"] = "guessed-value"
    #       return {"parser" => guessed}
    #     else
    #       return {}
    #     end
    #   end
    # end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-parser-variable_length_bytes-0.1.1 lib/embulk/guess/variable_length_bytes.rb
embulk-parser-variable_length_bytes-0.1.0 lib/embulk/guess/variable_length_bytes.rb