class Xommelier::DS::Element

Public Class Methods

any!(_options = {}) click to toggle source
# File lib/xommelier/ds.rb, line 58
def self.any!(_options = {})
  # TODO: implement <any /> logic
end
attribute(name, options = {}) click to toggle source

Defines containing attribute

Calls superclass method
# File lib/xommelier/ds.rb, line 53
def self.attribute(name, options = {})
  options[:as] ||= name.to_s.camelcase
  super(name, options)
end
choice!(_options = {}) { || ... } click to toggle source
# File lib/xommelier/ds.rb, line 62
def self.choice!(_options = {})
  # TODO: implement <choice /> logic
  may do
    yield
  end
end
find_element_name() click to toggle source
# File lib/xommelier/ds.rb, line 48
def self.find_element_name
  name.demodulize
end
has_algorithm(map = {}) click to toggle source
# 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 = {}) { || ... } click to toggle source
# File lib/xommelier/ds.rb, line 69
def self.sequence!(_options = {})
  # TODO: implement <choice /> logic
  yield
end