Class: Xommelier::Xml::Element::Structure::Attribute

Inherits:
Property
  • Object
show all
Defined in:
lib/xommelier/xml/element/structure/property.rb

Constant Summary collapse

DEFAULTS =
{
  type: String,
  required: false,
  optional: true,
  xml: false
}.freeze

Instance Attribute Summary

Attributes inherited from Property

#name, #options

Instance Method Summary collapse

Methods inherited from Property

#complex_type?, #default, #default?, #initialize, #inspect, #ns, #type, #writer

Constructor Details

This class inherits a constructor from Xommelier::Xml::Element::Structure::Property

Instance Method Details

#attribute_nameObject



140
141
142
143
144
145
146
# File 'lib/xommelier/xml/element/structure/property.rb', line 140

def attribute_name
  @attribute_name ||= if xml?
                        "xml:#{name}"
                      else
                        options.delete(:as) { name }.to_s
                      end
end

#node_typeObject



128
129
130
# File 'lib/xommelier/xml/element/structure/property.rb', line 128

def node_type
  :attribute
end

#required?Boolean

Returns:



132
133
134
# File 'lib/xommelier/xml/element/structure/property.rb', line 132

def required?
  options[:required]
end

#xml?Boolean

Returns:



136
137
138
# File 'lib/xommelier/xml/element/structure/property.rb', line 136

def xml?
  options[:xml]
end