Class: Etna::Cwl::PrimitiveLoader
Defined Under Namespace
Classes: BooleanLoader
Constant Summary
collapse
- STRING =
PrimitiveLoader.new('string', String)
- INT =
PrimitiveLoader.new('int', Integer)
- LONG =
PrimitiveLoader.new('long', Integer)
- FLOAT =
PrimitiveLoader.new('float', Float)
- DOUBLE =
PrimitiveLoader.new('double', Float)
- NULL =
PrimitiveLoader.new('null', NilClass)
- BOOLEAN =
BooleanLoader.new
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Loader
#as_array, #as_mapped_array, #map, #optional, #or
Constructor Details
70
71
72
73
|
# File 'lib/etna/cwl.rb', line 70
def initialize(name, type)
@name = name
@type = type
end
|
Class Method Details
.find_primitive_type_loader(type_name) ⇒ Object
87
88
89
90
91
92
93
94
|
# File 'lib/etna/cwl.rb', line 87
def self.find_primitive_type_loader(type_name)
constants.each do |c|
c = const_get(c)
if c.is_a?(Loader)
return c if c.name == type_name
end
end
end
|
Instance Method Details
#load(val) ⇒ Object
75
76
77
78
79
80
81
|
# File 'lib/etna/cwl.rb', line 75
def load(val)
unless val.is_a?(@type)
raise "Unexpected val #{val.inspect} for #{@name} type"
end
val
end
|
#name ⇒ Object
83
84
85
|
# File 'lib/etna/cwl.rb', line 83
def name
@name
end
|