Sha256: 1643da3778a1ebbbb0b059f7eef5daeea8370c74d6559d9689e24d0c8afae1ca

Contents?: true

Size: 1.92 KB

Versions: 96

Compression:

Stored size: 1.92 KB

Contents

module Embulk
  module Guess

    # TODO implement guess plugin to make this command work:
    #      $ embulk guess -g <%= name.dump %> 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).
%if language == :ruby

    #require <%= "embulk/#{embulk_category}/#{name}.rb".dump %>
%end

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

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

    #class <%= ruby_class_name.sub('Plugin', 'GuessPlugin') %> < LineGuessPlugin
    #  Plugin.register_guess(<%= name.dump %>, 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"] = <%= name.dump %>
    #      guessed["property1"] = "guessed-value"
    #      return {"parser" => guessed}
    #    else
    #      return {}
    #    end
    #  end
    #end

  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
embulk-0.8.18 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.18-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.17 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.17-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.16 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.16-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.15 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.15-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.14 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.14-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.13 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.13-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.12 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.12-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.11-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.11 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.10 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.10-java lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.9 lib/embulk/data/new/ruby/parser_guess.rb.erb
embulk-0.8.9-java lib/embulk/data/new/ruby/parser_guess.rb.erb