Sha256: 8f6d7443294d980d43bd573b819635513202c620765d8adf27db16aff2221e62

Contents?: true

Size: 444 Bytes

Versions: 8

Compression:

Stored size: 444 Bytes

Contents

# encoding: utf-8

module SayWhen
  module Utils
    def load_strategy(strategy_type, strategy)
      if strategy.is_a?(Symbol) || strategy.is_a?(String)
        require "say_when/#{strategy_type}/#{strategy}_strategy"
        class_name = "SayWhen::#{strategy_type.to_s.camelize}::#{strategy.to_s.camelize}Strategy"
        strategy_class = class_name.constantize
        strategy_class
      else
        strategy
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
say_when-2.2.2 lib/say_when/utils.rb
say_when-2.2.1 lib/say_when/utils.rb
say_when-2.2.0 lib/say_when/utils.rb
say_when-2.1.1 lib/say_when/utils.rb
say_when-2.1.0 lib/say_when/utils.rb
say_when-2.0.2 lib/say_when/utils.rb
say_when-2.0.1 lib/say_when/utils.rb
say_when-2.0.0 lib/say_when/utils.rb