module HealthCards::AttributeFilters::ClassMethods
Class level methods for HealthCard
class specific settings
Public Instance Methods
Define allowed attributes for this HealthCard
class @param type [Class] Scopes the attributes to a spefic class. Must be a subclass of FHIR::Model @param attributes [Array] An array of string with the attribute names that will be passed through
when data is minimized
# File lib/health_cards/attribute_filters.rb, line 18 def allow(type:, attributes: []) allowable[type] = attributes end
Define allowed attributes for this HealthCard
class @return [Hash] A hash of FHIR::Model subclasses and attributes that will pass through minimization
# File lib/health_cards/attribute_filters.rb, line 42 def allowable return @allowable if @allowable @allowable = parent_allowables end
Define disallowed attributes for this HealthCard
class @param type [Class] Scopes the attributes to a spefic class. If not used will default to all FHIR resources. To apply a rule to all FHIR types (resources and types), use FHIR::Model as the type @param attributes [Array] An array of string with the attribute names that will be passed through
when data is minimized
# File lib/health_cards/attribute_filters.rb, line 27 def disallow(type: ALL_FHIR_RESOURCES, attributes: []) disallowable[type] ||= [] disallowable[type].concat(attributes) end
Define disallowed attributes for this HealthCard
class @return [Hash] A hash of FHIR::Model subclasses and attributes that will pass through minimization
# File lib/health_cards/attribute_filters.rb, line 34 def disallowable return @disallowable if @disallowable @disallowable = parent_disallowables end
Protected Instance Methods
# File lib/health_cards/attribute_filters.rb, line 50 def parent_allowables(base = {}) self < HealthCards::HealthCard ? base.merge(superclass.allowable) : base end
# File lib/health_cards/attribute_filters.rb, line 54 def parent_disallowables(base = {}) self < HealthCards::HealthCard ? base.merge(superclass.disallowable) : base end