Class: Inferno::DSL::FHIRResourceValidation::ValidationContext
- Inherits:
-
Object
- Object
- Inferno::DSL::FHIRResourceValidation::ValidationContext
- Defined in:
- lib/inferno/dsl/fhir_resource_validation.rb
Constant Summary collapse
- VALIDATIONCONTEXT_DEFAULTS =
{ sv: '4.0.1', doNative: false, extensions: ['any'], disableDefaultResourceFetcher: true }.freeze
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
Instance Method Summary collapse
-
#initialize(definition) ⇒ ValidationContext
constructor
A new instance of ValidationContext.
- #method_missing(method_name, *args) ⇒ Object
- #respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(definition) ⇒ ValidationContext
Returns a new instance of ValidationContext.
735 736 737 738 |
# File 'lib/inferno/dsl/fhir_resource_validation.rb', line 735 def initialize(definition, &) @definition = VALIDATIONCONTEXT_DEFAULTS.merge(definition.deep_symbolize_keys) instance_eval(&) if block_given? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
740 741 742 743 744 745 746 747 748 |
# File 'lib/inferno/dsl/fhir_resource_validation.rb', line 740 def method_missing(method_name, *args) # Interpret any other method as setting a field on validationContext. # Follow the same format as `Validator.url` here: # only set the value if one is provided. # args will be an empty array if no value is provided. definition[method_name] = args[0] unless args.empty? definition[method_name] end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
726 727 728 |
# File 'lib/inferno/dsl/fhir_resource_validation.rb', line 726 def definition @definition end |
Instance Method Details
#respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
750 751 752 |
# File 'lib/inferno/dsl/fhir_resource_validation.rb', line 750 def respond_to_missing?(_method_name, _include_private = false) true end |