smart_enum 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smart_enum/active_record_compatibility.rb +20 -0
- data/lib/smart_enum/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8590b021c8102ae64f6bbc0658a318b4f9a9e569e287c54d8ccd7d6ac8ecc90
|
4
|
+
data.tar.gz: 5f019ccfa97705d647d4539b1b5e1929f6c138db0ffbad9578a56e0dd6389c65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdcd0005c811147bd984cb395e4d11f6d5f5da9e167c6cce9dbfe1e62450e823e0d06683d4b8fc459ce2902c8739917df5996168a1c88052011650e1b339c8cc
|
7
|
+
data.tar.gz: 70c300a1e1312dd430f1b0a4f7eeb8e8869427031cff53fde7e778148d975cb57c9c181590981c76eb0ad08879598cf18244b62b3ab19de310035968058de8b6
|
@@ -105,6 +105,26 @@ class SmartEnum
|
|
105
105
|
values
|
106
106
|
end
|
107
107
|
|
108
|
+
def first(num=nil)
|
109
|
+
if num
|
110
|
+
values.first(num)
|
111
|
+
else
|
112
|
+
values.first
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def last(num=nil)
|
117
|
+
if num
|
118
|
+
values.last(num)
|
119
|
+
else
|
120
|
+
values.last
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def count
|
125
|
+
values.count
|
126
|
+
end
|
127
|
+
|
108
128
|
STRING = [String].freeze
|
109
129
|
SYMBOL = [Symbol].freeze
|
110
130
|
BOOLEAN = [TrueClass, FalseClass].freeze
|
data/lib/smart_enum/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Brasic
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-07-
|
12
|
+
date: 2018-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
version: '0'
|
66
66
|
requirements: []
|
67
67
|
rubyforge_project:
|
68
|
-
rubygems_version: 2.7.
|
68
|
+
rubygems_version: 2.7.7
|
69
69
|
signing_key:
|
70
70
|
specification_version: 4
|
71
71
|
summary: Enums to replace database lookup tables
|