Sha256: 67a7dbdf02448c421c0d80176ee9c3926d9edd27d009ee5b49e9cf01dd80a6c5

Contents?: true

Size: 661 Bytes

Versions: 11

Compression:

Stored size: 661 Bytes

Contents

module Martyr
  module Schema
    class LevelAssociationCollection < HashWithIndifferentAccess
      include Martyr::LevelCollection

      # @param level [String, Symbol]
      # @return [LevelAssociation]
      def has_dimension_level(level, **args)
        level_definition = dimension_definition.levels[level]
        raise Schema::Error.new("Could not find level `#{level}` for dimension #{dimension_name}") unless level_definition
        level_association = LevelAssociation.new(self, level_definition, **args)
        register level_association
        arr = sort_by{|_name, level| level.to_i}
        clear.merge!(Hash[arr])
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
martyr-0.1.85.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.84.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.82.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.81.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.80.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.79.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.78.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.77.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.76.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.75.pre lib/martyr/schema/dimension_associations/level_association_collection.rb
martyr-0.1.74.pre lib/martyr/schema/dimension_associations/level_association_collection.rb