Sha256: 8e59f9296025679376eedec5776421936f26b40b5b75fa54c16187877e849eeb

Contents?: true

Size: 531 Bytes

Versions: 2

Compression:

Stored size: 531 Bytes

Contents

module Givepulse
    class ResourceMap
        def self.get_resource_class(resource)
            resource_classes = Givepulse::Resources.constants.select do |c|
                Givepulse::Resources.const_get(c).is_a? Class
            end
            map = {}
            resource_classes.each do |resource_class|
                map[resource_class.to_s.downcase.to_sym] = Givepulse::Resources.const_get(resource_class)
            end
            return unless map.key?(resource)
            map[resource]
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
givepulse-0.1.1 lib/givepulse/resource_map.rb
givepulse-0.1.0 lib/givepulse/resource_map.rb