Module: Odin::Transform::Direction
- Defined in:
- lib/odin/transform/transform_types.rb
Overview
Direction constants
Constant Summary collapse
- JSON_TO_JSON =
"json->json"- JSON_TO_ODIN =
"json->odin"- ODIN_TO_JSON =
"odin->json"- ODIN_TO_ODIN =
"odin->odin"- XML_TO_ODIN =
"xml->odin"- ODIN_TO_XML =
"odin->xml"- CSV_TO_ODIN =
"csv->odin"- ODIN_TO_CSV =
"odin->csv"- FIXED_TO_ODIN =
"fixed-width->odin"- ODIN_TO_FIXED =
"odin->fixed-width"- JSON_TO_XML =
"json->xml"- XML_TO_JSON =
"xml->json"- CSV_TO_JSON =
"csv->json"- JSON_TO_CSV =
"json->csv"- ALL =
[ JSON_TO_JSON, JSON_TO_ODIN, ODIN_TO_JSON, ODIN_TO_ODIN, XML_TO_ODIN, ODIN_TO_XML, CSV_TO_ODIN, ODIN_TO_CSV, FIXED_TO_ODIN, ODIN_TO_FIXED, JSON_TO_XML, XML_TO_JSON, CSV_TO_JSON, JSON_TO_CSV ].freeze
Class Method Summary collapse
Class Method Details
.parse(str) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/odin/transform/transform_types.rb', line 29 def self.parse(str) return nil unless str.is_a?(String) normalized = str.strip.downcase ALL.find { |d| d == normalized } end |
.source_format(direction) ⇒ Object
36 37 38 |
# File 'lib/odin/transform/transform_types.rb', line 36 def self.source_format(direction) direction&.split("->")&.first end |
.target_format(direction) ⇒ Object
40 41 42 |
# File 'lib/odin/transform/transform_types.rb', line 40 def self.target_format(direction) direction&.split("->")&.last end |