Class: Etna::Cwl

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

Defined Under Namespace

Classes: AnyLoader, ArrayLoader, ArrayType, EnumLoader, EnumType, FunctorMapLoader, InputParameter, Loader, MapLoader, NeverLoader, Operation, OptionalLoader, OutputParameter, PrimitiveLoader, RecordLoader, RecordType, SourceLoader, Step, StepInput, StepOutput, StrictMapLoader, TypedDSLLoader, UnionLoader, Workflow, WorkflowInputParameter, WorkflowOutputParameter

Constant Summary collapse

FIELD_LOADERS =
{}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Cwl

Returns a new instance of Cwl.



7
8
9
# File 'lib/etna/cwl.rb', line 7

def initialize(attributes)
  @attributes = attributes
end

Class Method Details

.as_json(obj) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/etna/cwl.rb', line 15

def self.as_json(obj)
  if obj.is_a?(Cwl)
    as_json(obj.instance_variable_get(:@attributes))
  elsif obj.is_a?(Hash)
    {}.tap do |result|
      obj.each do |k, v|
        result[k] = as_json(v)
      end
    end
  elsif obj.is_a?(Array)
    obj.map { |v| as_json(v) }
  else
    obj
  end
end

.load_item(val, field_type) ⇒ Object



491
492
493
494
495
496
497
498
499
500
501
# File 'lib/etna/cwl.rb', line 491

def self.load_item(val, field_type)
  if val.is_a?(Hash)
    if val.include?("$import")
      raise "$import expressions are not yet supported"
    elsif val.include?("$include")
      raise "$include expressions are not yet supported"
    end
  end

  return field_type.load(val)
end

.loaderObject



11
12
13
# File 'lib/etna/cwl.rb', line 11

def self.loader
  Etna::Cwl::RecordLoader.new(self)
end

Instance Method Details

#as_jsonObject



31
32
33
# File 'lib/etna/cwl.rb', line 31

def as_json
  self.class.as_json(@attributes)
end