Class: Shale::Mapping::Descriptor::Xml Private

Inherits:
Shale::Mapping::Dict show all
Defined in:
lib/shale/mapping/descriptor/xml.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 attribute mapping

Instance Attribute Summary collapse

Attributes inherited from Shale::Mapping::DictBase

#keys, #root

Instance Method Summary collapse

Methods inherited from Shale::Mapping::Dict

#group, #map, #render_nil

Methods inherited from Shale::Mapping::DictBase

#finalize!, #finalized?, #initialize_dup, #map, #properties

Constructor Details

#initialize(name:, attribute:, receiver:, methods:, group:, namespace:, cdata:, render_nil:) ⇒ Xml

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 instance

Parameters:

  • name (String)
  • attribute (Symbol, nil)
  • receiver (Symbol, nil)
  • methods (Hash, nil)
  • group (String, nil)
  • namespace (Shale::Mapping::XmlNamespace)
  • cdata (true, false)
  • render_nil (true, false)


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/shale/mapping/descriptor/xml.rb', line 38

def initialize(
  name:,
  attribute:,
  receiver:,
  methods:,
  group:,
  namespace:,
  cdata:,
  render_nil:
)
  super(
    name: name,
    attribute: attribute,
    receiver: receiver,
    methods: methods,
    group: group,
    render_nil: render_nil
  )

  @namespace = namespace
  @cdata = cdata
end

Instance Attribute Details

#cdatatrue, false (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 cdata

Returns:

  • (true, false)


24
25
26
# File 'lib/shale/mapping/descriptor/xml.rb', line 24

def cdata
  @cdata
end

#namespaceString (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 namespace

Returns:

  • (String)


17
18
19
# File 'lib/shale/mapping/descriptor/xml.rb', line 17

def namespace
  @namespace
end

Instance Method Details

#namespaced_nameString

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 with XML namespace

Returns:

  • (String)


75
76
77
# File 'lib/shale/mapping/descriptor/xml.rb', line 75

def namespaced_name
  [namespace.name, name].compact.join(':')
end

#prefixed_nameString

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 with XML prefix

Returns:

  • (String)


66
67
68
# File 'lib/shale/mapping/descriptor/xml.rb', line 66

def prefixed_name
  [namespace.prefix, name].compact.join(':')
end