lib/rambling/trie/configuration/properties.rb in rambling-trie-1.0.3 vs lib/rambling/trie/configuration/properties.rb in rambling-trie-2.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Rambling
module Trie
module Configuration
# Provides configurable properties for Rambling::Trie.
class Properties
@@ -15,12 +17,12 @@
# The configured {Compressor Compressor}.
# @return [Compressor] the configured compressor.
attr_accessor :compressor
- # The configured root_builder, which should return a {Nodes::Node Node} when
- # called.
+ # The configured root_builder, which should return a {Nodes::Node Node}
+ # when called.
# @return [Proc<Nodes::Node>] the configured root_builder.
attr_accessor :root_builder
# The configured tmp_path, which will be used for throwaway files.
# @return [String] the configured tmp_path.
@@ -34,34 +36,39 @@
# Resets back to default properties.
def reset
reset_readers
reset_serializers
- self.compressor = Rambling::Trie::Compressor.new
- self.root_builder = lambda { Rambling::Trie::Nodes::Raw.new }
- self.tmp_path = '/tmp'
+ @compressor = Rambling::Trie::Compressor.new
+ @root_builder = -> { Rambling::Trie::Nodes::Raw.new }
+ @tmp_path = '/tmp'
end
private
attr_writer :readers, :serializers
def reset_readers
plain_text_reader = Rambling::Trie::Readers::PlainText.new
- self.readers = Rambling::Trie::Configuration::ProviderCollection.new :reader, txt: plain_text_reader
+ @readers = Rambling::Trie::Configuration::ProviderCollection.new(
+ :reader,
+ txt: plain_text_reader,
+ )
end
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
- self.serializers = Rambling::Trie::Configuration::ProviderCollection.new :serializer,
+ @serializers = Rambling::Trie::Configuration::ProviderCollection.new(
+ :serializer,
marshal: marshal_serializer,
yml: yaml_serializer,
yaml: yaml_serializer,
- zip: zip_serializer
+ zip: zip_serializer,
+ )
end
end
end
end
end