Class: XsdModel::Elements::Element

Inherits:
Object
  • Object
show all
Includes:
BaseElement
Defined in:
lib/xsd_model/elements/element.rb

Constant Summary

Constants included from BaseElement

BaseElement::XSD_URI

Instance Attribute Summary

Attributes included from BaseElement

#attributes, #children, #namespaces

Instance Method Summary collapse

Methods included from BaseElement

#==, #basic_xsd_type?, #element_name, #empty?, #has_custom_type?, #initialize, #method_missing, #name_with_prefix, #reverse_traverse, #type_with_prefix, #xmlns_prefix, #xmlns_uri, #xsd_prefix

Methods included from AttributeMethods

#attribute_method

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class XsdModel::Elements::BaseElement

Instance Method Details

#has_ref?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/xsd_model/elements/element.rb', line 23

def has_ref?
  !ref.nil?
end

#max_occursObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/xsd_model/elements/element.rb', line 6

def max_occurs
  value = attributes['maxOccurs']

  case value
  when 'unbounded'
    then Float::INFINITY
  when String
    then value.to_i
  when nil
    then 1
  end
end

#multiple?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/xsd_model/elements/element.rb', line 19

def multiple?
  max_occurs > 1
end

#refObject



27
28
29
# File 'lib/xsd_model/elements/element.rb', line 27

def ref
  attributes['ref']
end