Sha256: 58c0ae929210fd3d7faf66df6e51d32ef89a54c42fd9fd73fac2b17848f3ff97

Contents?: true

Size: 365 Bytes

Versions: 33

Compression:

Stored size: 365 Bytes

Contents

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

  module ArrayExtension
    def to_composite_keys
      CompositeKeys.new(self)
    end
  end

  class CompositeKeys < Array
    def to_s
      # Doing this makes it easier to parse Base#[](attr_name)
      join(ID_SEP)
    end
  end
end

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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
composite_primary_keys-5.0.12 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.11 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.10 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.9 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.8 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.6 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-3.1.11 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.5 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.4 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.2 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.1 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.0 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-5.0.0.rc1 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-4.1.2 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-4.1.1 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-4.0.0 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-4.0.0.beta9 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-4.0.0.beta8 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-4.0.0.beta7 lib/composite_primary_keys/composite_arrays.rb
composite_primary_keys-4.0.0.beta6 lib/composite_primary_keys/composite_arrays.rb