Class: Stupidedi::Schema::CompositeElementUse

Inherits:
AbstractElementUse show all
Defined in:
lib/stupidedi/schema/element_use.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractElementUse

#composite?, #empty, #value

Methods included from Inspect

#inspect

Methods inherited from AbstractUse

#composite?, #definition?, #element?, #functional_group?, #interchange?, #loop?, #repeated?, #segment?, #table?, #transaction_set?, #usage?

Constructor Details

#initialize(definition, requirement, repeat_count, parent) ⇒ CompositeElementUse

Returns a new instance of CompositeElementUse


202
203
204
205
206
207
208
209
210
211
# File 'lib/stupidedi/schema/element_use.rb', line 202

def initialize(definition, requirement, repeat_count, parent)
  @definition, @requirement, @repeat_count, @parent =
    definition, requirement, repeat_count, parent

  # Delay re-parenting until the entire definition tree has a root
  # to prevent unnecessarily copying objects
  unless parent.nil?
    @definition = @definition.copy(:parent => self)
  end
end

Instance Attribute Details

#definitionCompositeElementDef (readonly)

Returns:


191
192
193
# File 'lib/stupidedi/schema/element_use.rb', line 191

def definition
  @definition
end

#parentSegmentDef (readonly)

Returns:


200
201
202
# File 'lib/stupidedi/schema/element_use.rb', line 200

def parent
  @parent
end

#repeat_countRepeatCount (readonly)

Returns:


197
198
199
# File 'lib/stupidedi/schema/element_use.rb', line 197

def repeat_count
  @repeat_count
end

#requirementElementReq (readonly)

Returns:


194
195
196
# File 'lib/stupidedi/schema/element_use.rb', line 194

def requirement
  @requirement
end

Instance Method Details

#component?Boolean

Returns false

Returns:

  • (Boolean)

    false


232
233
234
# File 'lib/stupidedi/schema/element_use.rb', line 232

def component?
  false
end

#copy(changes = {}) ⇒ CompositeElementUse

Returns:


214
215
216
217
218
219
220
# File 'lib/stupidedi/schema/element_use.rb', line 214

def copy(changes = {})
  CompositeElementUse.new \
    changes.fetch(:definition, @definition),
    changes.fetch(:requirement, @requirement),
    changes.fetch(:repeat_count, @repeat_count),
    changes.fetch(:parent, @parent)
end

#pretty_print(q)

This method returns an undefined value.


237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/stupidedi/schema/element_use.rb', line 237

def pretty_print(q)
  q.text("CompositeElementUse")
  q.group(2, "(", ")") do
    q.breakable ""
    q.pp @definition
    q.text ","

    q.breakable
    q.pp @requirement
    q.text ","

    q.breakable
    q.pp @repeat_count
  end
end

#repeatable?Boolean

Returns:

  • (Boolean)

222
223
224
# File 'lib/stupidedi/schema/element_use.rb', line 222

def repeatable?
  @repeat_count.try{|r| r.include?(2) }
end

#simple?Boolean

Returns false

Returns:

  • (Boolean)

    false


227
228
229
# File 'lib/stupidedi/schema/element_use.rb', line 227

def simple?
  false
end