Class: Odin::Transform::SegmentDef

Inherits:
Object
  • Object
show all
Defined in:
lib/odin/transform/transform_types.rb

Overview

Segment definition — a named section with field mappings

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, path: nil, array_index: nil, field_mappings: [], discriminator: nil, discriminator_value: nil, when_condition: nil, each_source: nil, if_condition: nil, elif_condition: nil, is_else: false, children: [], pass: nil, counter_name: nil, is_array: false, loops: [], is_literal: false, literal_body: nil) ⇒ SegmentDef

Returns a new instance of SegmentDef.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/odin/transform/transform_types.rb', line 135

def initialize(
  name:,
  path: nil,
  array_index: nil,
  field_mappings: [],
  discriminator: nil,
  discriminator_value: nil,
  when_condition: nil,
  each_source: nil,
  if_condition: nil,
  elif_condition: nil,
  is_else: false,
  children: [],
  pass: nil,
  counter_name: nil,
  is_array: false,
  loops: [],
  is_literal: false,
  literal_body: nil
)
  @name = name
  @path = path
  @array_index = array_index
  @field_mappings = field_mappings
  @discriminator = discriminator
  @discriminator_value = discriminator_value
  @when_condition = when_condition
  @each_source = each_source
  @if_condition = if_condition
  @elif_condition = elif_condition
  @is_else = is_else
  @children = children
  @pass = pass
  @counter_name = counter_name
  @is_array = is_array
  @loops = loops
  @is_literal = is_literal
  @literal_body = literal_body
end

Instance Attribute Details

#array_indexObject (readonly)

Returns the value of attribute array_index.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def array_index
  @array_index
end

#childrenObject (readonly)

Returns the value of attribute children.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def children
  @children
end

#counter_nameObject (readonly)

Returns the value of attribute counter_name.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def counter_name
  @counter_name
end

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def discriminator
  @discriminator
end

#discriminator_valueObject (readonly)

Returns the value of attribute discriminator_value.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def discriminator_value
  @discriminator_value
end

#each_sourceObject (readonly)

Returns the value of attribute each_source.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def each_source
  @each_source
end

#elif_conditionObject (readonly)

Returns the value of attribute elif_condition.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def elif_condition
  @elif_condition
end

#field_mappingsObject (readonly)

Returns the value of attribute field_mappings.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def field_mappings
  @field_mappings
end

#if_conditionObject (readonly)

Returns the value of attribute if_condition.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def if_condition
  @if_condition
end

#is_arrayObject (readonly)

Returns the value of attribute is_array.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def is_array
  @is_array
end

#is_elseObject (readonly)

Returns the value of attribute is_else.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def is_else
  @is_else
end

#is_literalObject (readonly)

Returns the value of attribute is_literal.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def is_literal
  @is_literal
end

#literal_bodyObject (readonly)

Returns the value of attribute literal_body.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def literal_body
  @literal_body
end

#loopsObject (readonly)

Returns the value of attribute loops.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def loops
  @loops
end

#nameObject (readonly)

Returns the value of attribute name.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def name
  @name
end

#passObject (readonly)

Returns the value of attribute pass.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def pass
  @pass
end

#pathObject (readonly)

Returns the value of attribute path.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def path
  @path
end

#when_conditionObject (readonly)

Returns the value of attribute when_condition.



128
129
130
# File 'lib/odin/transform/transform_types.rb', line 128

def when_condition
  @when_condition
end