Sha256: d1f42910025a3296bd12809e06d219b37d57995506db7830eafe5f7a843f88a9
Contents?: true
Size: 539 Bytes
Versions: 4
Compression:
Stored size: 539 Bytes
Contents
class ExplicitDelegator < SimpleDelegator def self.enforce_definitions(*methods) define_method(:enforced_methods) do super() | methods end end def initialize(obj) super(obj) ensure_defined end def enforced_methods [] end def ensure_defined missing_methods = [] enforced_methods.each do |method| missing_methods << method unless __getobj__.methods.include?(method) end raise "Methods required to use #{self.class}: #{missing_methods}" unless missing_methods.empty? end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
woople-theme-0.5.9 | lib/explicit_delegator.rb |
woople-theme-0.5.8 | lib/explicit_delegator.rb |
woople-theme-0.5.7 | lib/explicit_delegator.rb |
woople-theme-0.5.6 | lib/explicit_delegator.rb |