lib/datacaster/switch_node.rb in datacaster-3.1.3 vs lib/datacaster/switch_node.rb in datacaster-3.1.5

- old
+ new

@@ -14,14 +14,21 @@ @ons = on_casters @else = else_caster end - def on(caster_or_value, clause) + def on(caster_or_value, clause, strict: false) caster = case caster_or_value when Datacaster::Base caster_or_value + when String, Symbol + if strict + Datacaster::Predefined.compare(caster_or_value) + else + Datacaster::Predefined.compare(caster_or_value.to_s) | + Datacaster::Predefined.compare(caster_or_value.to_sym) + end else Datacaster::Predefined.compare(caster_or_value) end clause = DefinitionDSL.expand(clause)