class Intercept::StrategyBuilder
Public Class Methods
from_hash(strategy)
click to toggle source
# File lib/intercept/strategy_builder.rb, line 5 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
get_class(symbol)
click to toggle source
# File lib/intercept/strategy_builder.rb, line 16 def self.get_class(symbol) Object.const_get "Intercept::Strategy::#{symbol.to_s.split('_').map{ |w| w.capitalize }.join}" end