Sha256: 44ed252899ae30193abb0d50d558fe804a4e6b36b01c46aa7af9420c12a6eb6b

Contents?: true

Size: 459 Bytes

Versions: 2

Compression:

Stored size: 459 Bytes

Contents

module MicroMicro
  module Collections
    class PropertiesCollection < BaseCollection
      # @return [Array<String>]
      def names
        @names ||= map(&:name).uniq.sort
      end

      # @return [Hash{Symbol => Array<String, Hash>}]
      def to_h
        group_by(&:name).symbolize_keys.deep_transform_values(&:value)
      end

      # @return [Array<String, Hash>]
      def values
        @values ||= map(&:value).uniq
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
micromicro-1.1.0 lib/micro_micro/collections/properties_collection.rb
micromicro-1.0.0 lib/micro_micro/collections/properties_collection.rb