Sha256: 969be2e62d58dd433efa6155418d6698c506cdc8fa569040217a9a6b81763b0b

Contents?: true

Size: 1.24 KB

Versions: 135

Compression:

Stored size: 1.24 KB

Contents

require "expressir/express/aggregate_dimension"

module Expressir
  module Express
    class ExplicitAggregate < Explicit
      attr_accessor :rank, :dimensions

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

        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.25-arm64-darwin lib/expressir/express/explicit_aggregate.rb
expressir-0.2.24 lib/expressir/express/explicit_aggregate.rb
expressir-0.2.24-x86_64-linux lib/expressir/express/explicit_aggregate.rb
expressir-0.2.24-x86_64-darwin lib/expressir/express/explicit_aggregate.rb
expressir-0.2.24-x86-mingw32 lib/expressir/express/explicit_aggregate.rb
expressir-0.2.24-x86-linux lib/expressir/express/explicit_aggregate.rb
expressir-0.2.24-x64-mingw32 lib/expressir/express/explicit_aggregate.rb
expressir-0.2.24-arm64-darwin lib/expressir/express/explicit_aggregate.rb
expressir-0.2.21 lib/expressir/express/explicit_aggregate.rb
expressir-0.2.21-x86_64-linux lib/expressir/express/explicit_aggregate.rb
expressir-0.2.21-x86_64-darwin lib/expressir/express/explicit_aggregate.rb
expressir-0.2.21-x86-mingw32 lib/expressir/express/explicit_aggregate.rb
expressir-0.2.21-x86-linux lib/expressir/express/explicit_aggregate.rb
expressir-0.2.21-x64-mingw32 lib/expressir/express/explicit_aggregate.rb
expressir-0.2.21-arm64-darwin lib/expressir/express/explicit_aggregate.rb
expressir-0.2.19 lib/expressir/express/explicit_aggregate.rb
expressir-0.2.19-x86_64-linux lib/expressir/express/explicit_aggregate.rb
expressir-0.2.19-x86_64-darwin lib/expressir/express/explicit_aggregate.rb
expressir-0.2.19-x86-mingw32 lib/expressir/express/explicit_aggregate.rb
expressir-0.2.19-x86-linux lib/expressir/express/explicit_aggregate.rb