lib/datacaster/switch_node.rb in datacaster-3.2.0 vs lib/datacaster/switch_node.rb in datacaster-3.2.1

- old
+ new

@@ -2,10 +2,11 @@ class SwitchNode < Base def initialize(base = nil, on_casters = [], else_caster = nil) @base = base if Datacaster::Utils.pickable?(@base) - @base = Datacaster::Predefined.pick(@base) + @base = Datacaster::Predefined.run { checked_key!(base) } & + Datacaster::Predefined.pick(base) end if !@base.nil? && !Datacaster.instance?(@base) raise RuntimeError, "provide a Datacaster::Base instance, a hash key, or an array of keys to switch(...) caster", caller end