19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/has_easy.rb', line 19
def has_easy(context = nil, options = {})
context = Helpers.normalize(context)
class << self
attr_accessor :has_easy_configurators unless method_defined?(:has_easy_configurators)
end
self.has_easy_configurators = {} if self.has_easy_configurators.nil?
raise ArgumentError, "class #{self} already has_easy('#{context}')" if self.has_easy_configurators.has_key?(context)
configurator = Configurator.new(self, context, options)
yield configurator
configurator.do_metaprogramming_magic_aka_define_methods
has_easy_configurators[context] = configurator
end
|