Sha256: 57af84f9445681da233fe93903d6593a42fa080b17522328ebdca83c7a03a695

Contents?: true

Size: 414 Bytes

Versions: 9

Compression:

Stored size: 414 Bytes

Contents

require 'active_support/core_ext/string/inflections'

module Bbq
  class Util
    def self.find_module(name, scope = nil)
      namespace = case scope
      when String, Symbol
        "::#{scope.to_s.camelize}"
      when Class
        "::#{scope.name}"
      when NilClass
        nil
      else
        "::#{scope.class.name}"
      end
      "#{namespace}::#{name.to_s.camelize}".constantize
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bbq-0.2.1 lib/bbq/util.rb
bbq-0.2.0 lib/bbq/util.rb
bbq-0.1.0 lib/bbq/util.rb
bbq-0.0.4 lib/bbq/util.rb
bbq-0.0.3 lib/bbq/util.rb
bbq-0.0.2 lib/bbq/util.rb
bbq-0.0.2.beta.3 lib/bbq/util.rb
bbq-0.0.2.beta.2 lib/bbq/util.rb
bbq-0.0.2.beta.1 lib/bbq/util.rb