Sha256: 558703b04a8c8dcfc3a93deedbb0e6143977fd217e73fbfb7e4cb79659207155
Contents?: true
Size: 730 Bytes
Versions: 4
Compression:
Stored size: 730 Bytes
Contents
module Tangle module Mixin # # Mixin to initialize the dynamic mixin system # module Initialize attr_reader :mixins private def initialize_mixins(mixins: nil, **kwargs) @mixins = mixins extend_with_mixins unless @mixins.nil? initialize_kwargs(**kwargs) unless kwargs.empty? end def extend_with_mixins klass = self.class.name[/[^:]+$/].to_sym @mixins.each do |mixin| extend(mixin.const_get(klass)) if mixin.const_defined?(klass) end end def initialize_kwargs(**kwargs) kwargs.each do |keyword, argument| send("initialize_kwarg_#{keyword}", argument) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tangle-0.9.0 | lib/tangle/mixin.rb |
tangle-0.8.2 | lib/tangle/mixin.rb |
tangle-0.8.1 | lib/tangle/mixin.rb |
tangle-0.8.0 | lib/tangle/mixin.rb |