Sha256: 5005656883274fcbfb0f52314c0f6614e46a30fc6fced338c5eb18e22160547e
Contents?: true
Size: 541 Bytes
Versions: 3
Compression:
Stored size: 541 Bytes
Contents
# frozen_string_literal: true module Intercept class StrategyBuilder def self.from_hash(strategy) return unless strategy strategy_class = get_class(strategy[:name]) if fallback = Intercept::StrategyBuilder.from_hash(strategy[:fallback]) strategy_class.new(strategy[:args], fallback) else strategy_class.new(strategy[:args]) end end def self.get_class(symbol) Object.const_get "Intercept::Strategy::#{symbol.to_s.split('_').map{ |w| w.capitalize }.join}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
intercept-0.2.5 | lib/intercept/strategy_builder.rb |
intercept-0.2.2 | lib/intercept/strategy_builder.rb |
intercept-0.2.1 | lib/intercept/strategy_builder.rb |