Class: Omnizip::Algorithms::LZMA::MatchFinderFactory
- Inherits:
-
Object
- Object
- Omnizip::Algorithms::LZMA::MatchFinderFactory
- Defined in:
- lib/omnizip/algorithms/lzma/match_finder_factory.rb
Overview
Factory for creating Match Finder instances
This factory implements the Factory pattern to create different match finder implementations based on configuration. It provides a clean separation between the configuration (what) and the implementation (how).
Class Method Summary collapse
-
.create(config) ⇒ MatchFinder, Implementations::SevenZip::LZMA::MatchFinder
Create a match finder instance based on configuration.
-
.from_options(options = {}) ⇒ MatchFinder, Implementations::SevenZip::LZMA::MatchFinder
Create match finder from options hash (convenience method).
Class Method Details
.create(config) ⇒ MatchFinder, Implementations::SevenZip::LZMA::MatchFinder
Create a match finder instance based on configuration
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/omnizip/algorithms/lzma/match_finder_factory.rb', line 46 def self.create(config) config.validate! case config.mode when "sdk" Implementations::SevenZip::LZMA::MatchFinder.new(config) when "simplified" # Use simplified MatchFinder implementation MatchFinder.new(config.window_size, config.max_match_length) else raise ArgumentError, "Unknown match finder mode: #{config.mode}" end end |
.from_options(options = {}) ⇒ MatchFinder, Implementations::SevenZip::LZMA::MatchFinder
Create match finder from options hash (convenience method)
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/omnizip/algorithms/lzma/match_finder_factory.rb', line 67 def self.( = {}) config = if [:sdk_compatible] MatchFinderConfig.sdk_config( dict_size: [:dict_size] || 65536, level: [:level] || 5, ) else MatchFinderConfig.simplified_config( dict_size: [:dict_size] || 65536, ) end create(config) end |