Sha256: d8ecfe8d738c56bb8395ed2d2877aadd34f7091da09eb32287098cd0e8c6821b

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require "expressir/express/type"

module Expressir
  module Express
    class TypeAggregate < Type
      attr_accessor :rank, :dimensions
      def initialize(options = {})
        @rank = 0
        @dimensions = []
        @wheres = []
        @selectedBy = []

        super(options)
      end

      private

      def extract_type_attributes(document)
        @name = document.first.attributes["name"].to_s
        @dimensions = document.map do |aggregate|
          Express::AggregateDimension.parse(aggregate)
        end

        @rank = @dimensions.size
        extract_builtintype_attributes(document)
      end

      def extract_builtintype_attributes(document)
        builtin_type = document.xpath("builtintype").first

        if builtin_type
          @isBuiltin = true
          @domain = builtin_type.attributes["type"].to_s
          @width = builtin_type.attributes["width"].to_s
          @fixed = builtin_type.attributes["fixed"] == "YES"
          @precision = builtin_type.attributes["precision"].to_s
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
expressir-0.2.6 lib/expressir/express/type_aggregate.rb
expressir-0.2.5-x64-mingw32 lib/expressir/express/type_aggregate.rb
expressir-0.2.4-x64-mingw32 lib/expressir/express/type_aggregate.rb