Module: PaperclipPrivate::Whitelist

Defined in:
lib/paperclip_private/whitelist.rb

Class Method Summary collapse

Class Method Details

.names_for_class(klass) ⇒ Object



7
8
9
# File 'lib/paperclip_private/whitelist.rb', line 7

def self.names_for_class(klass)
	registry[klass] || []
end

.register(hash = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/paperclip_private/whitelist.rb', line 18

def self.register(hash = {})
	hash.each do |k, v|
		if v.is_a? Array
			v.each { |name| register_class(k, name) }
		else
			register_class(k, v)
		end
	end
end

.register_class(klass, name) ⇒ Object



11
12
13
14
15
16
# File 'lib/paperclip_private/whitelist.rb', line 11

def self.register_class(klass, name)
	return if klass.nil? || name.nil?
	class_name = klass.to_s
	registry[class_name] ||= []
	registry[class_name] << name.to_s
end

.registryObject



3
4
5
# File 'lib/paperclip_private/whitelist.rb', line 3

def self.registry
	@registry ||= {}
end