Class: Rambling::Trie::Configuration::Properties
- Inherits:
-
Object
- Object
- Rambling::Trie::Configuration::Properties
- Defined in:
- lib/rambling/trie/configuration/properties.rb,
sig/lib/rambling/trie/configuration/properties.rbs
Overview
Provides configurable properties for Rambling::Trie. :reek:TooManyInstanceVariables { max_instance_variables: 5 }
Instance Attribute Summary collapse
-
#compressor ⇒ Compressor
The configured Compressor.
-
#readers ⇒ ProviderCollection<Readers::Reader>
The configured Readers.
-
#root_builder ⇒ Proc<Nodes::Node>
The configured
root_builder, which returns a Node when called. -
#serializers ⇒ ProviderCollection<Serializers::Serializer>
The configured Serializers.
-
#tmp_path ⇒ String
The configured
tmp_path, which will be used for throwaway files.
Instance Method Summary collapse
- #default_reader_providers ⇒ Hash[Symbol, Readers::Reader]
-
#initialize ⇒ Properties
constructor
Returns a new properties instance.
-
#reset ⇒ void
Resets back to default properties.
- #reset_readers ⇒ void
- #reset_serializers ⇒ void
Constructor Details
#initialize ⇒ Properties
Returns a new properties instance.
32 33 34 |
# File 'lib/rambling/trie/configuration/properties.rb', line 32 def initialize reset end |
Instance Attribute Details
#compressor ⇒ Compressor
The configured Compressor.
21 22 23 |
# File 'lib/rambling/trie/configuration/properties.rb', line 21 def compressor @compressor end |
#readers ⇒ ProviderCollection<Readers::Reader>
The configured Readers.
13 14 15 |
# File 'lib/rambling/trie/configuration/properties.rb', line 13 def readers @readers end |
#root_builder ⇒ Proc<Nodes::Node>
The configured root_builder, which returns a Node when called.
25 26 27 |
# File 'lib/rambling/trie/configuration/properties.rb', line 25 def root_builder @root_builder end |
#serializers ⇒ ProviderCollection<Serializers::Serializer>
The configured Serializers.
17 18 19 |
# File 'lib/rambling/trie/configuration/properties.rb', line 17 def serializers @serializers end |
#tmp_path ⇒ String
The configured tmp_path, which will be used for throwaway files.
29 30 31 |
# File 'lib/rambling/trie/configuration/properties.rb', line 29 def tmp_path @tmp_path end |
Instance Method Details
#default_reader_providers ⇒ Hash[Symbol, Readers::Reader]
55 56 57 |
# File 'lib/rambling/trie/configuration/properties.rb', line 55 def default_reader_providers { txt: Rambling::Trie::Readers::PlainText.new } end |
#reset ⇒ void
This method returns an undefined value.
Resets back to default properties.
38 39 40 41 42 43 44 45 |
# File 'lib/rambling/trie/configuration/properties.rb', line 38 def reset reset_readers reset_serializers @compressor = Rambling::Trie::Compressor.new @root_builder = -> { Rambling::Trie::Nodes::Raw.new } @tmp_path = Dir.tmpdir end |
#reset_readers ⇒ void
This method returns an undefined value.
51 52 53 |
# File 'lib/rambling/trie/configuration/properties.rb', line 51 def reset_readers @readers = Rambling::Trie::Configuration::ProviderCollection.new :reader, default_reader_providers end |
#reset_serializers ⇒ void
This method returns an undefined value.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rambling/trie/configuration/properties.rb', line 59 def reset_serializers marshal_serializer = Rambling::Trie::Serializers::Marshal.new yaml_serializer = Rambling::Trie::Serializers::Yaml.new zip_serializer = Rambling::Trie::Serializers::Zip.new self @serializers = Rambling::Trie::Configuration::ProviderCollection.new( :serializer, marshal: marshal_serializer, yml: yaml_serializer, yaml: yaml_serializer, zip: zip_serializer, ) end |