Class: Xommelier::DS::Element

Inherits:
Xml::Element show all
Defined in:
lib/xommelier/ds.rb

Constant Summary

Constants included from Xml::Element::Serialization

Xml::Element::Serialization::SAVE_OPTIONS, Xml::Element::Serialization::SERIALIZATION_OPTIONS

Instance Attribute Summary

Attributes inherited from Xml::Element

#options

Attributes included from Xml::Element::Namespace

#schema_validation_errors

Class Method Summary collapse

Methods inherited from Xml::Element

#initialize, #inspect

Methods included from Xml::Element::Serialization

#<=>, #==, #=~, #from_xml, #to_hash, #to_nokogiri, #to_s, #to_xml

Methods included from Xml::Element::Namespace

#valid?

Constructor Details

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

Class Method Details

.any!(_options = {}) ⇒ Object



58
59
60
# File 'lib/xommelier/ds.rb', line 58

def self.any!(_options = {})
  # TODO: implement <any /> logic
end

.attribute(name, options = {}) ⇒ Object

Defines containing attribute



53
54
55
56
# File 'lib/xommelier/ds.rb', line 53

def self.attribute(name, options = {})
  options[:as] ||= name.to_s.camelcase
  super(name, options)
end

.choice!(_options = {}) ⇒ Object



62
63
64
65
66
67
# File 'lib/xommelier/ds.rb', line 62

def self.choice!(_options = {})
  # TODO: implement <choice /> logic
  may do
    yield
  end
end

.find_element_nameObject



48
49
50
# File 'lib/xommelier/ds.rb', line 48

def self.find_element_name
  name.demodulize
end

.has_algorithm(map = {}) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/xommelier/ds.rb', line 74

def self.has_algorithm(map = {})
  attribute :algorithm, type: Uri, required: true

  const_set(:ALGORITHMS, map)
  map.each do |name, algorithm|
    define_singleton_method("new_#{name}") do |options = {}|
      new(options.merge(algorithm: algorithm))
    end
  end

  define_method(:algorithm_name) do
    map.key(algorithm.to_s)
  end
end

.sequence!(_options = {}) ⇒ Object



69
70
71
72
# File 'lib/xommelier/ds.rb', line 69

def self.sequence!(_options = {})
  # TODO: implement <choice /> logic
  yield
end