Sha256: 334f45aea8a9d8789c8409e8f7b3434907bcaecb0b2a3cf0e222b9ac173db8c9

Contents?: true

Size: 1.17 KB

Versions: 135

Compression:

Stored size: 1.17 KB

Contents

module Expressir
  module Express
    class DerivedAggregate < Derived
      attr_accessor :rank, :dimensions

      def initialize(options = {})
        @rank = 0
        @dimensions = []

        super(options)
      end

      private

      def extract_type_specific_attributes(document)
        @dimensions = document.xpath("aggregate").map do |aggregate|
          Express::AggregateDimension.parse(aggregate)
        end

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

      # @todo: Non existance attributes
      #
      # In the codebase, they are trying to add couple of aggregate
      # dimensions related attributes that was never a part of the
      # Explict class, but for consistency we are keeping those as
      # it is for now. let's revist those later and fix it.
      #
      def extract_inverse_aggregate(document)
        aggregates = document.xpath("inverse.aggregate")

        if !aggregates.empty?
          dimension = Express::AggregateDimension.parse(aggregates.first)
          @aggrtype = dimension.aggrtype
          @lower = dimension.lower
          @upper = dimension.upper
        end
      end
    end
  end
end

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
expressir-0.2.7-x86-mingw32 lib/expressir/express/derived_aggregate.rb
expressir-0.2.7-x64-mingw32 lib/expressir/express/derived_aggregate.rb
expressir-0.2.7-x86_64-linux lib/expressir/express/derived_aggregate.rb
expressir-0.2.7-x86-linux lib/expressir/express/derived_aggregate.rb
expressir-0.2.7-x86_64-darwin lib/expressir/express/derived_aggregate.rb
expressir-0.2.7-arm64-darwin lib/expressir/express/derived_aggregate.rb
expressir-0.2.5-x86_64-linux lib/expressir/express/derived_aggregate.rb
expressir-0.2.5-x86_64-darwin-19 lib/expressir/express/derived_aggregate.rb
expressir-0.2.5 lib/expressir/express/derived_aggregate.rb
expressir-0.2.4 lib/expressir/express/derived_aggregate.rb
expressir-0.2.3 lib/expressir/express/derived_aggregate.rb
expressir-0.2.2 lib/expressir/express/derived_aggregate.rb
expressir-0.2.1 lib/expressir/express/derived_aggregate.rb
expressir-0.2.0 lib/expressir/express/derived_aggregate.rb
expressir-0.1.0 lib/expressir/express/derived_aggregate.rb