Sha256: dd54e2c7d597312525d13e04b34e9031355be836528d15fdb1e001cb89eb1dce

Contents?: true

Size: 752 Bytes

Versions: 135

Compression:

Stored size: 752 Bytes

Contents

require "expressir/express/model_element"

module Expressir
  module Express
    class UniqueRule < ModelElement
      attr_accessor :name, :attributes

      def initialize(options)
        @name = nil
        @attributes = []
        @options = options
      end

      def parse
        document = @options.fetch(:document, nil)
        extract_unique_attributes(document)

        self
      end

      def self.parse(document)
        new(document: document).parse
      end

      private

      def extract_unique_attributes(document)
        @name = document.attributes["label"].to_s
        @attributes = document.xpath("unique.attribute").map do |attribute|
          attribute.attributes["attribute"]
        end
      end
    end
  end
end

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
expressir-0.2.16-x86-linux lib/expressir/express/unique_rule.rb
expressir-0.2.16-x64-mingw32 lib/expressir/express/unique_rule.rb
expressir-0.2.16-arm64-darwin lib/expressir/express/unique_rule.rb
expressir-0.2.15 lib/expressir/express/unique_rule.rb
expressir-0.2.15-x86_64-linux lib/expressir/express/unique_rule.rb
expressir-0.2.15-x86_64-darwin lib/expressir/express/unique_rule.rb
expressir-0.2.15-x86-mingw32 lib/expressir/express/unique_rule.rb
expressir-0.2.15-x86-linux lib/expressir/express/unique_rule.rb
expressir-0.2.15-x64-mingw32 lib/expressir/express/unique_rule.rb
expressir-0.2.15-arm64-darwin lib/expressir/express/unique_rule.rb
expressir-0.2.14 lib/expressir/express/unique_rule.rb
expressir-0.2.14-x86_64-linux lib/expressir/express/unique_rule.rb
expressir-0.2.14-x86_64-darwin lib/expressir/express/unique_rule.rb
expressir-0.2.14-x86-mingw32 lib/expressir/express/unique_rule.rb
expressir-0.2.14-x86-linux lib/expressir/express/unique_rule.rb
expressir-0.2.14-x64-mingw32 lib/expressir/express/unique_rule.rb
expressir-0.2.14-arm64-darwin lib/expressir/express/unique_rule.rb
expressir-0.2.13 lib/expressir/express/unique_rule.rb
expressir-0.2.13-x86_64-linux lib/expressir/express/unique_rule.rb
expressir-0.2.13-x86_64-darwin lib/expressir/express/unique_rule.rb