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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4882a3bbae8ab52762aaa62b44e1ba9599aef5ac71c618eeb268a808a6560073
4
- data.tar.gz: 730906218a7baa84742f09fef262f31b2f00a12be574ae35e460518e03555fa4
3
+ metadata.gz: b8590b021c8102ae64f6bbc0658a318b4f9a9e569e287c54d8ccd7d6ac8ecc90
4
+ data.tar.gz: 5f019ccfa97705d647d4539b1b5e1929f6c138db0ffbad9578a56e0dd6389c65
5
5
  SHA512:
6
- metadata.gz: 1c0eb912a0b9980c8926ef41ed0f198876829ae6b97756b3e7f646aa0eced3336cdadb2c2d664212805174fa8c551ec192c107e0e81ba4b6616583244f7a20f1
7
- data.tar.gz: 3f2c302472b6a44e9a1f88360fd450604af5c1ad0c72a5830cce39a46605b27800c1e0a5c910320333366e0edaa9eebf520aaca8ad234cdfb3c3f995ad50d3ec
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SmartEnum
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
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.0.0
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-17 00:00:00.000000000 Z
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.4
68
+ rubygems_version: 2.7.7
69
69
  signing_key:
70
70
  specification_version: 4
71
71
  summary: Enums to replace database lookup tables