Module: Magic::Lookup::Namespaces

Included in:
Magic::Lookup
Defined in:
lib/magic/lookup/namespaces.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#namespacesObject



8
# File 'lib/magic/lookup/namespaces.rb', line 8

def namespaces = @namespaces ||= [ nil ]

Instance Method Details

#for(object_class, *namespaces) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/magic/lookup/namespaces.rb', line 10

def for object_class, *namespaces
	return super unless namespaces.empty?

	self.namespaces
			.reverse # recently added first
			.lazy    # optimization
			.filter_map { super object_class, _1 }
			.first
end