5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/delorean/functions.rb', line 5
def delorean_fn(name, options = {}, &block)
if options[:cache] == true
new_options = options.reject { |key, _| key == :cache }
return _cached_delorean_fn(name, new_options, &block)
end
any_args = Delorean::Ruby::Whitelists::Matchers::Arguments::ANYTHING
define_singleton_method(name, block)
if options[:private] == true
singleton_class.class_eval { private name }
else
::Delorean::Ruby.whitelist.add_class_method name do |method|
method.called_on self, with: any_args
end
end
name.to_sym
end
|