Sha256: f9b6df1528dfc9645eef923cf45133ce66d08fd0364cc37a2b4f15b9d94b3c56

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 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

3 entries across 3 versions & 1 rubygems

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