Class: Inferno::DSL::FHIRResourceValidation::CliContext

Inherits:
Object
  • Object
show all
Defined in:
lib/inferno/dsl/fhir_resource_validation.rb

Constant Summary collapse

CLICONTEXT_DEFAULTS =
{
  sv: '4.0.1',
  doNative: false,
  extensions: ['any'],
  disableDefaultResourceFetcher: true
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition) ⇒ CliContext

Returns a new instance of CliContext.



337
338
339
340
# File 'lib/inferno/dsl/fhir_resource_validation.rb', line 337

def initialize(definition, &)
  @definition = CLICONTEXT_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



343
344
345
346
347
348
349
350
351
# File 'lib/inferno/dsl/fhir_resource_validation.rb', line 343

def method_missing(method_name, *args)
  # Interpret any other method as setting a field on cliContext.
  # 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

#definitionObject (readonly)

Returns the value of attribute definition.



327
328
329
# File 'lib/inferno/dsl/fhir_resource_validation.rb', line 327

def definition
  @definition
end

Instance Method Details

#respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


354
355
356
# File 'lib/inferno/dsl/fhir_resource_validation.rb', line 354

def respond_to_missing?(_method_name, _include_private = false)
  true
end