Sha256: cdaa81d8cfa867e7bc8bd6b2b2fa00aee47e354fd6e487618c1910908635372c
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
module Celluloid module Supervision class Configuration class << self def valid?(configuration, fails=false) parameters(:mandatory).each do |k| unless configuration.key? k if fails fail Error::Incomplete, "Missing `:#{k}` in supervision configuration." else return false end end end arity.each do |klass, args| unless configuration[args].is_a? Proc __a = configuration[args] && configuration[args].count || 0 __arity = configuration[klass].allocate.method(:initialize).arity unless (__arity < 0 && __a >= __arity.abs - 1) || __a == __arity.abs if fails fail ArgumentError.new("#{__a} vs. #{__arity}") else return false end end end end true end def options(config={}, options={}) configuration = config.merge(options) return configuration if configuration.is_a? Configuration configuration[:configuration] = Container::Behavior.configure(configuration) valid?(configuration, true) configuration end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
celluloid-supervision-0.20.6 | lib/celluloid/supervision/validation.rb |
celluloid-supervision-0.20.5 | lib/celluloid/supervision/validation.rb |