Class: Esse::Hooks::Mixin

Inherits:
Module
  • Object
show all
Defined in:
lib/esse/hooks/mixin.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store_key:) ⇒ Mixin



6
7
8
# File 'lib/esse/hooks/mixin.rb', line 6

def initialize(store_key:)
  @store_key = store_key
end

Instance Attribute Details

#store_keyObject (readonly)

Returns the value of attribute store_key.



4
5
6
# File 'lib/esse/hooks/mixin.rb', line 4

def store_key
  @store_key
end

Instance Method Details

#included(base) ⇒ Object



10
11
12
13
14
# File 'lib/esse/hooks/mixin.rb', line 10

def included(base)
  store_store_key = store_key # closure
  base.define_singleton_method(:store_key) { store_store_key }
  base.extend(ClassMethods)
end