Sha256: 71d1f03fbd0aadf54b820abeb3b9251ea17bf5ae06aa5bcd2803077c84c8047d

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

module AssLauncher
  module Support
    # Implemet section of v8i file
    class V8iSection
      attr_accessor :caption
      attr_reader :fields
      def initialize(caption, fields)
        fail ArgumentError unless\
          self.class.fields_required & fields.keys == self.class.fields_required
        @caption = caption
        @fields = fields
      end

      # Define required fields of v8i
      # @return [Array<String>]
      #  - Connect - connection string to infobase
      def self.fields_required
        %w( Connect )
      end

      # Define extra fields for v8i not defined 1C. This fields use
      # admin tools for automate support infodases
      # @return [Array<String>] of:
      #  - AdmConnect - connection string to infobase for admin tools.
      #    'Srvr' or 'File' connects only
      #  - BaseCodeName - infobase configuration code name. For example
      #    'Accounting', 'HRM', 'KzAccounting' etc.
      #  - GetUpdateInfoURI - URI for configuration updateinfo file for example:
      #    http://downloads.1c.ru/ipp/ITSREPV/V8Update/Configs/Accounting/20/82/
      #  - BaseCurentVersion - curent configuration version
      #  - GlobalWS - connection string for access to infobase from internet
      #  - Vendor - configuration vendor. '1C' 'Rarys' etc.
      def self.fields_extras
        %w( AdmConnect
            BaseCodeName
            GetUpdateInfoURI
            BaseCurentVersion
            GlobalWS
            Vendor )
      end

      # Define optional fields of v8i
      # @return [Array<String>]
      def self.fields_optional
        'TODO'
      end

      def [](key)
        fields[key]
      end

      def []=(key, value)
        fields[key] = value
      end

      def key?(key)
        fields.key?(key)
      end

      def to_s
        res = ''
        res << "[#{caption}]\r\n"
        fields.each do |key, value|
          res << "#{key}=#{value}\r\n"
        end
        res
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ass_launcher-0.1.1.alpha lib/ass_launcher/support/v8i_section.rb