Module: Paramix::Parametric::Extensions

Defined in:
lib/paramix.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) [](parameters = {})



44
45
46
# File 'lib/paramix.rb', line 44

def [](parameters={})
  Mixin.new(self, parameters)
end

- (Object) append_features(base)



58
59
60
61
62
63
64
65
66
67
# File 'lib/paramix.rb', line 58

def append_features(base)
  return super(base) if Mixin === base || Mixin === self

  base.extend(Extensions)

  anc = ancestors.find{ |a| a.respond_to?(:parameterized) }
  base.parameterized.concat(anc.parameterized)

  super(base)
end

- (Object) extend_object(base)



70
71
72
73
74
75
76
77
78
79
# File 'lib/paramix.rb', line 70

def extend_object(base)
  return super(base) if Mixin === base || Mixin === self

  base.extend(Extensions)

  anc = ancestors.find{ |a| a.respond_to?(:parameterized) }
  base.parameterized.concat(anc.parameterized)

  super(base)
end

- (Object) parameterized(&code)



49
50
51
52
53
54
55
56
# File 'lib/paramix.rb', line 49

def parameterized(&code)
  @code ||= []
  if block_given?
    @code << code
  else
    @code
  end
end