Sha256: 1dc9e66a67ab87b73b524c7eef9a47d34def03c666e55b7e3229cd0dab07c927

Contents?: true

Size: 473 Bytes

Versions: 3

Compression:

Stored size: 473 Bytes

Contents

module Loofah
  module MetaHelpers
    def self.HashifiedConstants(orig_module)
      hashed_module = Module.new
      orig_module.constants.each do |constant|
        next unless orig_module.module_eval("#{constant}").is_a?(Array)
        hashed_module.module_eval <<-CODE
          #{constant} = {}
          #{orig_module.name}::#{constant}.each { |c| #{constant}[c] = true ; #{constant}[c.downcase] = true }
        CODE
      end
      hashed_module
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loofah-1.0.0 lib/loofah/metahelpers.rb
loofah-1.0.0.beta.1 lib/loofah/metahelpers.rb
loofah-0.4.7 lib/loofah/metahelpers.rb