------art_455_16535729.1324874930213
Content-Type: multipart/alternative; 
	boundary---art_456_18199749.1324874930213"

------art_456_18199749.1324874930213
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Going through some old code snippets and came across this clever bit. Back 
then I was planning to use this for Facets, before I finally determined 
that using mixins wasn't actually the best approach for a core extensions 
library.

  module Extension
    def self.included(base)
      name  ase.name.split('::').last
      core  val("::#{name}")
      core.send(:include, base)
    end
  end

Example:

    module Facets
      module String
        include Extension

        def drippy
          puts "Drippy #{self}"
        end
      end
    end

    "Hello".drippy

Just thought I'd share.


------art_456_18199749.1324874930213
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div>Going through some old code snippets and came across this clever bit. Back then I was planning to use this for Facets, before I finally determined that using mixins wasn't actually the best approach for a core extensionsibrary.</div><div><br></div><div>&nbsp; module Extension<br></div><div>&nbsp; &nbsp; def self.included(base)<br></div><div>&nbsp; &nbsp; &nbsp; name3D base.name.split('::').last</div><div>&nbsp; &nbsp; &nbsp; core = eval("::#{name}")</div><div>&nbsp; &nbsp; &nbsp; core.send(:include, base)</div><div>&nbsp; &nbsp; end</div><div>&nbsp; end<br></div><div><br></div><div>Example:</div><div><br></div><div>&nbsp; &nbsp; module Facets</div><div>&nbsp; &nbsp; &nbsp; module String</div><div>&nbsp; &nbsp; &nbsp; &nbsp; include Extension</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; def drippy</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; puts "Drippy #{self}"</div><div>&nbsp; &nbsp; &nbsp; &nbsp; end</div><div>&nbsp; &nbsp; &nbsp; end</div><div>&nbsp; &nbsp; end</div><div><br></div><div>&nbsp; &nbsp; "Hello".drippy</div><div><br></div><div>Just thought I'd share.</div><div><br></div>
------art_456_18199749.1324874930213--

------art_455_16535729.1324874930213--