Class: Etna::Cwl::RecordType::Field

Inherits:
Etna::Cwl
  • Object
show all
Defined in:
lib/etna/cwl.rb

Defined Under Namespace

Classes: FieldLoader

Constant Summary

Constants inherited from Etna::Cwl

FIELD_LOADERS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Etna::Cwl

#as_json, as_json, #initialize, load_item, loader

Constructor Details

This class inherits a constructor from Etna::Cwl

Class Method Details

.type_loader(type) ⇒ Object



402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/etna/cwl.rb', line 402

def self.type_loader(type)
  case type
  when Array
    type_loaders = type.map { |t| Field.type_loader(t) }
    return nil if type_loaders.any?(&:nil?)
    UnionLoader.new(*type_loaders)
  when EnumType
    type.type_loader
  when RecordType
    type.type_loader
  when ArrayType
    type.type_loader
  when String
    PrimitiveLoader.find_primitive_type_loader(type)
  else
    raise "Could not determine loader for type #{type.inspect}"
  end
end

Instance Method Details

#nameObject



390
391
392
# File 'lib/etna/cwl.rb', line 390

def name
  @attributes['name']
end

#typeObject



394
395
396
# File 'lib/etna/cwl.rb', line 394

def type
  @attributes['type']
end

#type_loaderObject



398
399
400
# File 'lib/etna/cwl.rb', line 398

def type_loader
  self.class.type_loader(self.type)
end