Sha256: 866f56fa8d6638f5ce6b29a9c9b021c7bdc41223e213d915b07e6fe7349cd9d7
Contents?: true
Size: 890 Bytes
Versions: 3
Compression:
Stored size: 890 Bytes
Contents
class Sekken class ExampleMessage def self.build(parts) memo = {} parts.each do |element| name = element.name.to_sym case when element.simple_type? base_type_local = element.base_type.split(':').last base_type_local = [base_type_local] unless element.singular? memo[name] = base_type_local when element.complex_type? value = build(element.children) unless element.attributes.empty? value.merge! collect_attributes(element) end value = [value] unless element.singular? memo[name] = value end end memo end private def self.collect_attributes(element) element.attributes.each_with_object({}) { |attribute, memo| memo["_#{attribute.name}".to_sym] = attribute.base_type } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sekken-0.3.0 | lib/sekken/example_message.rb |
sekken-0.2.0 | lib/sekken/example_message.rb |
sekken-0.1.0 | lib/sekken/example_message.rb |