Sha256: 37e0c8b7f0485fda36908a6085908c8e4805384cbd8070220dc35542fc40e4af
Contents?: true
Size: 1010 Bytes
Versions: 20
Compression:
Stored size: 1010 Bytes
Contents
module Ddr::Models::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
20 entries across 20 versions & 1 rubygems