Sha256: d5775ce50d67cdfe294b49bd292b9d9d39d2c81bc27c874e7fbfd113e0df8f10
Contents?: true
Size: 708 Bytes
Versions: 3
Compression:
Stored size: 708 Bytes
Contents
module SmokeMonster class LazyCover < Cover def initialize(block) @block = block self.public_methods.select{ |x| x.to_s.include?("the_original_subject") == false }.each do |method| remove_method method end @can_allow_method_missing_to_work_now = true end alias :old_the_original_subject :the_original_subject def the_original_subject @subject = @block.call old_the_original_subject end private alias :old_method_missing :method_missing def method_missing(meth, *args, &blk) return nil unless @can_allow_method_missing_to_work_now @subject = @block.call old_method_missing meth, *args, &blk end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
smoke_monster-0.3.0 | lib/smoke_monster/lazy_cover.rb |
smoke_monster-0.2.3 | lib/smoke_monster/lazy_cover.rb |
smoke_monster-0.2.2 | lib/smoke_monster/lazy_cover.rb |