Class: Shale::Schema::XMLGenerator::TypedElement Private

Inherits:
Element
  • Object
show all
Defined in:
lib/shale/schema/xml_generator/typed_element.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class representing XML Schema element with a name and a type

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Element

#as_xml

Constructor Details

#initialize(name:, type:, default: nil, collection: false, required: false) ⇒ TypedElement

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize TypedElement object

Parameters:

  • name (String)
  • type (String)
  • default (String, nil) (defaults to: nil)
  • collection (true, false) (defaults to: false)
  • required (true, false) (defaults to: false)


29
30
31
32
33
# File 'lib/shale/schema/xml_generator/typed_element.rb', line 29

def initialize(name:, type:, default: nil, collection: false, required: false)
  super(default, collection, required)
  @name = name
  @type = type
end

Instance Attribute Details

#nameString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return name

Returns:

  • (String)


18
19
20
# File 'lib/shale/schema/xml_generator/typed_element.rb', line 18

def name
  @name
end

Instance Method Details

#attributesHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return attributes as Ruby Hash

Returns:

  • (Hash)


40
41
42
# File 'lib/shale/schema/xml_generator/typed_element.rb', line 40

def attributes
  { 'name' => @name, 'type' => @type }
end