seq_as_enum 0.1.0 → 0.2.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: 19a14a4dcc30167b2d7577d1dab343571f8e48ad77c1ec5db2b8f3906a1becd6
4
- data.tar.gz: cb35ee9aaa2fd4a738ea1d198c878b07e9b75799a2b92c7e27f824a6035e7163
3
+ metadata.gz: 6ed043cc3fc1e665375938158a59ea4f383fdd950c92c9ed1dd83eee62955efd
4
+ data.tar.gz: 99db0b6e544984f67a1fb47fcad0a08bcb15f0461b07200b65f6bfd5093b3c79
5
5
  SHA512:
6
- metadata.gz: d05e62eb3d8714bfee09fd238de2e04690cfeb3de056bd280548852e41453df197826424d2bc1bcd718c0ccd551ff416987a17fac9f7572a1c5f7e138a194ec1
7
- data.tar.gz: 05c96a6376f2a658c869c77ecf2bfc96c1a2acfed4d4c46e3710fa3f45b192ca300d0fd289cdf94fde76daa011dbe3df20f8ac4c847e68e8319657de16e64011
6
+ metadata.gz: acc00518b38c8be7670fdc9b1d6ed6ab9e066099a04dd04e1723649ded370269752d8499e7138e81201a310b5d6f9668a691048e1303c7c9f07d48b06a5c8594
7
+ data.tar.gz: 1ab81b07529fcd49895fed3a21d57f4d74b118aadfc5a8d008043047278ccbf015c4b9278917f651179a49da4f5736855c896d4887a9374afb576c1246f6b272
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## [Unreleased]
2
2
 
3
+ - Use Struct instead of Data for Ruby 3.1.x and 3.0.x environments.
4
+
3
5
  ## [0.1.0] - 2023-06-06
4
6
 
5
7
  - Initial release
data/README.md CHANGED
@@ -123,6 +123,8 @@ class AwesomeCsv
123
123
  end
124
124
  ```
125
125
 
126
+ NOTE: If you use Ruby 3.1.x or 3.0.x, data_as will use Struct instead of Data.
127
+
126
128
  ## Development
127
129
 
128
130
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SeqAsEnum
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/seq_as_enum.rb CHANGED
@@ -14,7 +14,7 @@ module SeqAsEnum
14
14
 
15
15
  if data_as
16
16
  class_name = "#{data_as}Data"
17
- data_class = Data.define(*names)
17
+ data_class = const_defined?(:Data) ? Data.define(*names) : Struct.new(*names, keyword_init: true)
18
18
  const_set!(class_name, data_class)
19
19
  data = data_class.new(**key_values)
20
20
  const_set!(data_as, data)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seq_as_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Junichi Ito
@@ -10,7 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2023-06-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Provide enum like sequences as constants or Data object.
13
+ description: Provide enum like sequences as constants.
14
14
  email:
15
15
  - me@jnito.com
16
16
  executables: []
@@ -45,15 +45,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 3.2.0
48
+ version: 3.0.0
49
49
  required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  requirements: []
55
- rubygems_version: 3.4.1
55
+ rubygems_version: 3.4.10
56
56
  signing_key:
57
57
  specification_version: 4
58
- summary: Provide enum like sequences as constants or Data object.
58
+ summary: Provide enum like sequences as constants.
59
59
  test_files: []