Module: Phlex::Kit::LazyLoader

Defined in:
lib/phlex/kit.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/phlex/kit.rb', line 5

def method_missing(name, ...)
	mod = self.class

	if name[0] == name[0].upcase && mod.constants.include?(name) && mod.const_get(name) && methods.include?(name)
		public_send(name, ...)
	else
		super
	end
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean



15
16
17
18
19
# File 'lib/phlex/kit.rb', line 15

def respond_to_missing?(name, include_private = false)
	mod = self.class

	(name[0] == name[0].upcase && mod.constants.include?(name) && mod.const_get(name) && methods.include?(name)) || super
end