File: xml_source.rb

package info (click to toggle)
ruby-riddle 2.3.1-2~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,752 kB
  • sloc: sql: 25,022; php: 5,992; ruby: 4,757; sh: 59; makefile: 5
file content (35 lines) | stat: -rw-r--r-- 943 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

module Riddle
  class Configuration
    class XMLSource < Riddle::Configuration::Source
      def self.settings 
        [
          :type, :xmlpipe_command, :xmlpipe_field,
          :xmlpipe_attr_uint, :xmlpipe_attr_bool, :xmlpipe_attr_timestamp,
          :xmlpipe_attr_str2ordinal, :xmlpipe_attr_float, :xmlpipe_attr_multi,
          :xmlpipe_fixup_utf8
        ]
      end
      
      attr_accessor *self.settings
      
      def initialize(name, type)
        @name = name
        @type = type
        
        @xmlpipe_field            = []
        @xmlpipe_attr_uint        = []
        @xmlpipe_attr_bool        = []
        @xmlpipe_attr_timestamp   = []
        @xmlpipe_attr_str2ordinal = []
        @xmlpipe_attr_float       = []
        @xmlpipe_attr_multi       = []
      end
            
      def valid?
        super && ( !@xmlpipe_command.nil? || !parent.nil? )
      end
    end
  end
end