Sha256: 636e7be31d6fec6968694b545aa2734585092c21a43de86d96d70d059f2d76e9
Contents?: true
Size: 1002 Bytes
Versions: 43
Compression:
Stored size: 1002 Bytes
Contents
module Ddr::Structures # # Wraps a Nokogiri (XML) 'agent' node # class Agent < SimpleDelegator ROLE_CREATOR = 'CREATOR'.freeze NAME_REPOSITORY_DEFAULT = 'REPOSITORY DEFAULT'.freeze def id self['ID'] end def role self['ROLE'] end def otherrole self['OTHERROLE'] end def type self['TYPE'] end def othertype self['OTHERTYPE'] end def name xpath('xmlns:name').first.content end def self.build(args) node = Nokogiri::XML::Node.new('agent', args[:document]) node['ID'] = args[:id] if args[:id] node['ROLE'] = args[:role] if args[:role] node['OTHERROLE'] = args[:otherrole] if args[:otherrole] node['TYPE'] = args[:type] if args[:type] node['OTHERTYPE'] = args[:othertype] if args[:othertype] name_node = Nokogiri::XML::Node.new('name', args[:document]) name_node.content = args[:name] node.add_child(name_node) node end end end
Version data entries
43 entries across 43 versions & 1 rubygems