lib/tnql/nodes/registry.rb in tnql-1.0.4 vs lib/tnql/nodes/registry.rb in tnql-1.1.0

- old
+ new

@@ -1,9 +1,23 @@ module Tnql #:nodoc: all module Nodes module RegistryNode def meta_data_item - { 'tumour.registry' => { Tnql::EQUALS => registry.to_registrycode } } + registrycode = registry.to_registrycode + exclude_crown_dependency = !exclude.blank? && exclude.to_registrycode == registrycode + { 'tumour.registry' => { Tnql::EQUALS => [registrycode, exclude_crown_dependency] } } + end + end + + module ExcludeCrownDependencyNode + CROWN_DEPENDENCY_REGISTRY = { + 'channel islands' => 'Y1001', + 'iom' => 'Y1701', + 'isle of man' => 'Y1701' + }.freeze unless defined?(CROWN_DEPENDENCY_REGISTRY) + + def to_registrycode + CROWN_DEPENDENCY_REGISTRY[crown_dependency.text_value] end end module RegistryCodeNode def to_registrycode