Module: Paramix::Parametric::Extensions
- Defined in:
- lib/paramix.rb
Instance Method Summary collapse
- #[](parameters = {}) ⇒ Object
- #append_features(base) ⇒ Object
- #extend_object(base) ⇒ Object
- #parameterized(&code) ⇒ Object
Instance Method Details
#[](parameters = {}) ⇒ Object
44 45 46 |
# File 'lib/paramix.rb', line 44 def [](parameters={}) Mixin.new(self, parameters) end |
#append_features(base) ⇒ Object
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 |
#extend_object(base) ⇒ Object
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 |
#parameterized(&code) ⇒ Object
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 |