Class: Declarative::Heritage

Inherits:
Array
  • Object
show all
Defined in:
lib/declarative/heritage.rb

Defined Under Namespace

Modules: DSL, Included, Inherited

Instance Method Summary collapse

Instance Method Details

#call(inheritor, &block) ⇒ Object

Replay the recorded assignments on inheritor. Accepts a block that will allow processing the arguments for every recorded statement.



10
11
12
# File 'lib/declarative/heritage.rb', line 10

def call(inheritor, &block)
  each { |cfg| call!(inheritor, cfg, &block) }
end

#record(method, *args, &block) ⇒ Object

Record inheritable assignments for replay in an inheriting class.



4
5
6
# File 'lib/declarative/heritage.rb', line 4

def record(method, *args, &block)
  self << {method: method, args: DeepDup.(args), block: block} # DISCUSS: options.dup.
end