Skip to content

Feature request: add ability to configure readers and serializers #11

@gonzedge

Description

@gonzedge

Now that the gem can serialize in-memory tries into disk and back, let's add the ability for people to configure them. Someone using the gem should be able to configure the available serializers, the default serializer, etc. I'm thinking an API like this:

require 'rambling-trie'

Rambling::Trie.config do |c|
  c.serializers.add :json, MyJsonSerializer.new
  c.serializers.default = c.serializers[:yml]
end

# Load a trie from disk and do things with it...

Also, the way Readers are configured and treated in general should be very similar to what would be done with Serializers. That way, you could also provide your own readers for getting a list of words from disk (or any IO, really):

require 'rambling-trie'

Rambling::Trie.config do |c|
  c.readers.add :html, MyHtmlReader.new
  c.readers.default = c.readers[:html]
end

# Create a trie and do things with it...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions