Sha256: 7add0fc542a6c29bbae7bc48713276eb53552c5aea84b9b37712fc5eef91189b
Contents?: true
Size: 601 Bytes
Versions: 1
Compression:
Stored size: 601 Bytes
Contents
module Priora class Configuration def initialize @conversion_lambdas = { TrueClass: lambda { |_| 1 }, FalseClass: lambda { |_| 0 }, NilClass: lambda { |_| 0 } } end def conversion_lambda_for(klass) @conversion_lambdas[klass.to_s.to_sym] end def add_conversion_lambda(klass, lambda) raise InvalidConversionLambda if lambda.arity > 1 @conversion_lambdas[klass.to_s.to_sym] = lambda end def remove_conversion_lambda(klass) @conversion_lambdas.delete_if { |k, _| k == klass.to_s.to_sym } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
priora-0.1.0 | lib/priora/configuration.rb |