Class: Odin::Transform::TransformDef
- Inherits:
-
Object
- Object
- Odin::Transform::TransformDef
- Defined in:
- lib/odin/transform/transform_types.rb
Overview
Transform definition — top-level AST node
Instance Attribute Summary collapse
-
#accumulators ⇒ Object
readonly
Returns the value of attribute accumulators.
-
#constants ⇒ Object
readonly
Returns the value of attribute constants.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#imports ⇒ Object
readonly
Returns the value of attribute imports.
-
#passes ⇒ Object
readonly
Returns the value of attribute passes.
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
- #direction ⇒ Object
- #discriminator_config ⇒ Object
-
#initialize(header:, segments: [], constants: {}, tables: {}, accumulators: {}, passes: [], imports: []) ⇒ TransformDef
constructor
A new instance of TransformDef.
- #source_format ⇒ Object
- #target_format ⇒ Object
Constructor Details
#initialize(header:, segments: [], constants: {}, tables: {}, accumulators: {}, passes: [], imports: []) ⇒ TransformDef
Returns a new instance of TransformDef.
63 64 65 66 67 68 69 70 71 |
# File 'lib/odin/transform/transform_types.rb', line 63 def initialize(header:, segments: [], constants: {}, tables: {}, accumulators: {}, passes: [], imports: []) @header = header @segments = segments @constants = constants @tables = tables @accumulators = accumulators @passes = passes @imports = imports end |
Instance Attribute Details
#accumulators ⇒ Object (readonly)
Returns the value of attribute accumulators.
61 62 63 |
# File 'lib/odin/transform/transform_types.rb', line 61 def accumulators @accumulators end |
#constants ⇒ Object (readonly)
Returns the value of attribute constants.
61 62 63 |
# File 'lib/odin/transform/transform_types.rb', line 61 def constants @constants end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
61 62 63 |
# File 'lib/odin/transform/transform_types.rb', line 61 def header @header end |
#imports ⇒ Object (readonly)
Returns the value of attribute imports.
61 62 63 |
# File 'lib/odin/transform/transform_types.rb', line 61 def imports @imports end |
#passes ⇒ Object (readonly)
Returns the value of attribute passes.
61 62 63 |
# File 'lib/odin/transform/transform_types.rb', line 61 def passes @passes end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
61 62 63 |
# File 'lib/odin/transform/transform_types.rb', line 61 def segments @segments end |
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
61 62 63 |
# File 'lib/odin/transform/transform_types.rb', line 61 def tables @tables end |
Instance Method Details
#direction ⇒ Object
73 74 75 |
# File 'lib/odin/transform/transform_types.rb', line 73 def direction header&.direction end |
#discriminator_config ⇒ Object
87 88 89 |
# File 'lib/odin/transform/transform_types.rb', line 87 def discriminator_config header&.&.dig("discriminator") end |
#source_format ⇒ Object
77 78 79 80 81 |
# File 'lib/odin/transform/transform_types.rb', line 77 def source_format # Prefer explicit source.format from {$source} section sf = header&.&.dig("format") sf && !sf.empty? ? sf : Direction.source_format(direction) end |
#target_format ⇒ Object
83 84 85 |
# File 'lib/odin/transform/transform_types.rb', line 83 def target_format header&.target_format || Direction.target_format(direction) end |