tablesalt 0.9.2 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tablesalt/array_index.rb +29 -0
- data/lib/tablesalt/version.rb +1 -1
- data/lib/tablesalt.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dad7e20ae350e0e54f884e2fca05f59004d428968fe8c657d59000058f6e9cc
|
4
|
+
data.tar.gz: d7fa448bdcf15b765b931665ba80eaf0cc58d31efba04caf4ccff89cde17c872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8d1b8afa60670037d4c7f3b37de22cf750ee90e49284abea6b3758f20d21a1ebe249729538d4dd6951026250b9af625d689900928f66c5b9885214e525bb689
|
7
|
+
data.tar.gz: f5db473feff15d8f9bd0c1008edf0041b0f0d459d2ad0c8ddbb5b3ebd6e44386f8e5dab5204033a3cc4c3a9698a152e8fd2b122c6ff657159b045ca5ffa81ab7
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tablesalt
|
4
|
+
class ArrayIndex
|
5
|
+
class << self
|
6
|
+
alias_method :[], :new
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader :array
|
10
|
+
|
11
|
+
delegate :[], to: :index
|
12
|
+
|
13
|
+
def initialize(array)
|
14
|
+
@array = array.deep_dup
|
15
|
+
end
|
16
|
+
|
17
|
+
def index
|
18
|
+
@index ||= array.each_with_index.each_with_object({}) do |(element, index), hash|
|
19
|
+
hash[element] = index unless hash.key?(element)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def freeze
|
24
|
+
index.freeze
|
25
|
+
array.freeze
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/tablesalt/version.rb
CHANGED
data/lib/tablesalt.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tablesalt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Minneti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- LICENSE.txt
|
50
50
|
- README.md
|
51
51
|
- lib/tablesalt.rb
|
52
|
+
- lib/tablesalt/array_index.rb
|
52
53
|
- lib/tablesalt/hash_model.rb
|
53
54
|
- lib/tablesalt/version.rb
|
54
55
|
homepage: https://github.com/Freshly/spicerack/tree/master/tablesalt
|