yaml_enumeration 0.4.0 → 0.5.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: 789056e38408fc39c5203d9b27347d67eac1223a005c4e97d6c3fbb0b50e52c9
4
- data.tar.gz: f687bbcc331fa6959225a5701721b156ae652dc5c51540f4a85d2b8c75d66ab0
3
+ metadata.gz: 7af81ba9c87a0967dd073af1af9efc89281f328f47e44c5d4677d7ae0074fdfa
4
+ data.tar.gz: e53b25152bbdda6c3b4b1acea36d123abae2be84e53e3031f42d1a55aae8f6a1
5
5
  SHA512:
6
- metadata.gz: 937de680ad7a668d42faa880eac779d53d0bfb9833bfdf981f50c97cf3703d113de49e550b3290ae27c9a7ca7173d44b0630cbf5922a07e60464b98886cb20e5
7
- data.tar.gz: bc24da29146aac8453d17badffaf83176dc8c937d54eff3660ead43b8261237445741c1db95fff163bdf8f0fddeb80adc6e2f925573f3aa2d71604a4c05b3b8d
6
+ metadata.gz: e909ed89c6c32d3b6d60219ab5c81de2ae551fe0d4282c631a15f29a12fc4237f7b5be1620c839a25efa2918e8268050ac7fbcb1af4816839c3d1b7596e65ede
7
+ data.tar.gz: '096504aa3169d54cd443e9e29a018cb1bcf8b2f43dc15fe3dca81b103ff17cd4bf4c0c65314c211e920d429c28fd3ee1ea4e2669fabd902128c740227e638ec4'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.5.0
4
+ * introduce `count`, `first` and `last` methods [#8](https://github.com/alto/yaml_enumeration/pull/8)
5
+
3
6
  ## 0.4.0
4
7
  * add support for Ruby `3.1` [#7](https://github.com/alto/yaml_enumeration/pull/7)
5
8
 
@@ -78,6 +78,21 @@ module YamlEnumeration
78
78
  self.all_instances ||= values.keys.map {|id| new(id)}
79
79
  end
80
80
 
81
+ def count
82
+ return 0 unless values
83
+ all.size
84
+ end
85
+
86
+ def first
87
+ return nil unless values
88
+ all.first
89
+ end
90
+
91
+ def last
92
+ return nil unless values
93
+ all.last
94
+ end
95
+
81
96
  def find(id)
82
97
  case id
83
98
  when Integer
@@ -1,3 +1,3 @@
1
1
  module YamlEnumeration
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml_enumeration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thorsten Boettger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-28 00:00:00.000000000 Z
11
+ date: 2023-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler