Module: Cant::Embeddable

Includes:
Questionable
Defined in:
lib/cant/embeddable.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Questionable

#cant?, #die_if_cant!

Class Method Details

.included(base) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cant/embeddable.rb', line 17

def included(base)
  base.extend Cant::Editable
  
  # XXX this sucks if class defines its own inherited callback and includes Cant::Embeddable
  # double evil : order of inherited and extend statement has an effect : latter overwrite earlier !!!
  class << base
    def inherited(subclass)
      subclass.rules.concat(rules)
      [:die, :fold].each do |attr|
        subclass.send(attr, &(send(attr)))
      end
      super
    end
  end
end

Instance Method Details

#cantfigurationObject



35
36
37
# File 'lib/cant/embeddable.rb', line 35

def cantfiguration
  self.class
end