Sha256: 77a2b3f077ba7017909ef6cf54c96fa686445b99ba5c7683e7ad2d7ee0935e0f
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
module TroleGroups::Macros class Configuration class StrategyLoader < BaseLoader def initialize strategy, orm super end def strategy_module @strategy_module ||= orm_strategy_module || generic_strategy_module end protected def orm_strategy_module @orm_strategy_module ||= begin mods_found = ["#{orm_namespace}::Strategy::#{strategy.to_s.camelize}", "#{namespace}::Strategy::#{base_class}"].select do |full_name| try_module(full_name) end !mods_found.empty? ? mods_found.first.constantize : nil end end def generic_strategy_module strategy_name, options @generic_module ||= begin base_class = base_name(strategy_name) # use generic if no ORM specific strategy found! ns = namespace(strategy_name, options) mods_found = ["#{namespace}::Strategy::#{strategy.to_s.camelize}", "#{namespace}::Strategy::#{base_class}"].select do |full_name| try_module(full_name) end !mods_found.empty? ? mods_found.first.constantize : nil end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems