Sha256: 23790a2e610020f7f07147cca0b97c0985670c19d52ba1bae0def5943461296c

Contents?: true

Size: 489 Bytes

Versions: 16

Compression:

Stored size: 489 Bytes

Contents

module CompositePrimaryKeys
  ID_SEP     = ','
  ID_SET_SEP = ';'

  module ArrayExtension
    def to_composite_keys
      CompositeKeys.new(self)
    end

    def to_composite_ids
      CompositeIds.new(self)
    end
  end

  class CompositeArray < Array
    def to_s
      join(ID_SEP)
    end
  end

  class CompositeKeys < CompositeArray

  end

  class CompositeIds < CompositeArray

  end
end

Array.send(:include, CompositePrimaryKeys::ArrayExtension)

Version data entries

16 entries across 16 versions & 5 rubygems

Version Path
jwulff-composite_primary_keys-1.0.9 lib/composite_primary_keys/composite_arrays.rb
kovyrin-composite_primary_keys-2.3.2 lib/composite_primary_keys/composite_arrays.rb
mingusbabcock-composite_primary_keys-2.2.2.1 lib/composite_primary_keys/composite_arrays.rb
tyler-composite_primary_keys-1.1.0 lib/composite_primary_keys/composite_arrays.rb
tyler-composite_primary_keys-1.1.1 lib/composite_primary_keys/composite_arrays.rb
tyler-composite_primary_keys-1.1.2 lib/composite_primary_keys/composite_arrays.rb
tyler-composite_primary_keys-1.1.3 lib/composite_primary_keys/composite_arrays.rb
tyler-composite_primary_keys-1.1.4 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-2.3.5.1 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-2.3.5 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-2.3.2 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-1.0.10 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-1.1.0 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-2.2.2 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-2.2.0 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-2.2.1 lib/composite_primary_keys/composite_arrays.rb