Sha256: f2535c5a68c282dfb3e2c813ff652068ea6681007425a916d786f64db3d75881
Contents?: true
Size: 680 Bytes
Versions: 1
Compression:
Stored size: 680 Bytes
Contents
require 'traitor/conflict_check' module Traitor class Trait def initialize(&block) @module_block = block @container = Module.new(&block) end def trait_methods @container.instance_methods(false) end def implements?(m) trait_methods.include?(m) end def call(host, m, *args, &block) metaclass = class << host; self; end blk = @module_block refinement = Module.new do refine metaclass, &blk end host.send :using, refinement host.send m, *args, &block end def self.check_conflict(host_class) ConflictCheck.check(host_class) end end end Trait = Traitor::Trait
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
traitor-0.0.1 | lib/traitor/trait.rb |