Class: Domain::HeadingBased

Inherits:
Module
  • Object
show all
Defined in:
lib/alf-core/ext/domain/heading_based.rb

Defined Under Namespace

Classes: AlgebraMethods, DomainMethods

Instance Method Summary collapse

Constructor Details

#initialize(master_class) ⇒ HeadingBased

Returns a new instance of HeadingBased.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/alf-core/ext/domain/heading_based.rb', line 4

def initialize(master_class)
  define_method(:new){|*args|
    raise "#{master_class}.new may not be called directly" if master_class==self
    super(*args)
  }
  define_method(:type){|generating_type|
    meths   = [
      DomainMethods.new(master_class, generating_type),
      AlgebraMethods.new(master_class, generating_type),
      Domain::Comparisons,
    ]
    Class.new(master_class).extend(*meths).heading_based_factored
  }
  alias_method :[], :type
  define_method(:heading_based_factored) do
    self
  end
end