Sha256: bda4f8525a3bc296a81b61d1e828b20f1b68c2e10db9fb6751a1e0f0314e7ee2
Contents?: true
Size: 515 Bytes
Versions: 2
Compression:
Stored size: 515 Bytes
Contents
# frozen_string_literal: true module Prependers class Prepender < Module attr_reader :namespace def initialize(namespace = nil) @namespace = namespace end def included(base) prepended_module_name = base.name.split('::')[0..-2].join('::') if namespace prepended_module_name = (prepended_module_name[(namespace.name.length + 2)..-1]).to_s end prepended_module = Object.const_get(prepended_module_name) prepended_module.prepend base end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prependers-0.1.1 | lib/prependers/prepender.rb |
prependers-0.1.0 | lib/prependers/prepender.rb |