Module: ActiveKit::Bedrock::Bedrockable

Included in:
Export::Exportable, Search::Searchable
Defined in:
lib/active_kit/bedrock/bedrockable.rb

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/active_kit/bedrock/bedrockable.rb', line 6

def self.extended(base)
  current_component = base.name.deconstantize.demodulize.downcase

  base.module_eval "    module ClassMethods\n      def \#{current_component}er\n        @\#{current_component}er ||= ActiveKit::\#{current_component.to_s.titleize}::\#{current_component.to_s.titleize}er.new(current_component: :\#{current_component}, current_class: self)\n      end\n\n      private\n\n      def \#{current_component}_describer(name, **options)\n        \#{current_component}er.create_describer(name, options)\n      end\n\n      def \#{current_component}_attribute(name, **options)\n        \#{current_component}er.create_attribute(name, options)\n      end\n    end\n  CODE\nend\n", __FILE__, __LINE__ + 1