Sha256: abfa7600cd9c3a631d91f0a87c26fac5f791112d0b65c1567f6934e1cca5a100
Contents?: true
Size: 347 Bytes
Versions: 26
Compression:
Stored size: 347 Bytes
Contents
class LazyModule < Module def self.new(&blk) # passing no-op block overrides &blk m = super{ } class << m include ClassMethods end m.lazy_evaluated_body = blk m end module ClassMethods attr_accessor :lazy_evaluated_body def included(host) host.class_eval(&@lazy_evaluated_body) end end end
Version data entries
26 entries across 25 versions & 6 rubygems