class Declarative::Heritage
Public Instance Methods
Source
# File lib/declarative/heritage.rb, line 12 def call(inheritor, &block) each { |cfg| call!(inheritor, cfg, &block) } end
Replay the recorded assignments on inheritor. Accepts a block that will allow processing the arguments for every recorded statement.
Source
# File lib/declarative/heritage.rb, line 6 def record(method, *args, &block) self << {method: method, args: DeepDup.(args), block: block} # DISCUSS: options.dup. end
Record inheritable assignments for replay in an inheriting class.
Private Instance Methods
Source
# File lib/declarative/heritage.rb, line 39 def call!(inheritor, cfg) yield cfg if block_given? # allow messing around with recorded arguments. inheritor.send(cfg[:method], *cfg[:args], &cfg[:block]) end