literal_enums 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +24 -0
- data/.gitignore +8 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +34 -0
- data/LICENSE.txt +21 -0
- data/README.md +175 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/enum.rb +63 -0
- data/lib/literal_enums/transitions.rb +33 -0
- data/lib/literal_enums/version.rb +3 -0
- data/lib/literal_enums.rb +11 -0
- data/literal_enums.gemspec +36 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5032b916232ac6faa5494185fcf1fd84914e3e7781f791a0466e9b7617d136b9
|
4
|
+
data.tar.gz: b7ab5c1a471672329cbd2f23707d206cd214c4bdb1b066ba908124750acd4e50
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 609cbdcfa378843a507deb5d01b9da8a66e5d91a5e3b96b723a57af19e1cb3cb056fa4c9eac7bee96edec89544ce3e8d290c3da3cc664c30d09b9796a0fe4577
|
7
|
+
data.tar.gz: 7f58231fbdad7bd52c717a0a05922661945fee6b0db62604bb85ee05d52fc62d9bc77071f11e7a8466cf84acc1f9911bca2e03481dad2e215b8d801dd25da432
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ['2.7', '3.0']
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
22
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
23
|
+
- name: Run tests
|
24
|
+
run: bundle exec rake
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.1
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at joel.drapper@shopify.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
literal_enums (1.0.0)
|
5
|
+
activesupport (~> 7.0.2.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (7.0.2.3)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
15
|
+
concurrent-ruby (1.1.9)
|
16
|
+
i18n (1.10.0)
|
17
|
+
concurrent-ruby (~> 1.0)
|
18
|
+
minitest (5.15.0)
|
19
|
+
rake (12.3.3)
|
20
|
+
tzinfo (2.0.4)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
|
23
|
+
PLATFORMS
|
24
|
+
arm64-darwin-21
|
25
|
+
x86_64-linux
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
bundler (~> 2.3.7)
|
29
|
+
literal_enums!
|
30
|
+
minitest (~> 5.0)
|
31
|
+
rake (~> 12.3.3)
|
32
|
+
|
33
|
+
BUNDLED WITH
|
34
|
+
2.3.7
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Joel Drapper
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
# literal_enums
|
2
|
+
|
3
|
+
Literal Enums makes Enumerations first-class citizens in Ruby, providing a literal definition syntax.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
You can define an enum by subclassing `Enum` and using the literal syntax.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class Color < Enum
|
11
|
+
Red()
|
12
|
+
Green()
|
13
|
+
Blue()
|
14
|
+
end
|
15
|
+
```
|
16
|
+
|
17
|
+
Here we’ve enumerated `Color::Red`, `Color::Green`, and `Color::Blue` constants that reference unique instances of `Color`. You can verify this in the console:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
Color::Red.is_a?(Color) # returns true
|
21
|
+
```
|
22
|
+
|
23
|
+
Enum classes have synthetic methods for looking up their members. `Color.members` will return a `Set` of members of the `Color` enumeration: `Color::Red`, `Color::Green`, and `Color::Blue`.
|
24
|
+
|
25
|
+
Members also have polymorphic predicate methods for each member of the enumeration in lower-snake-case.
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
color = Color::Red
|
29
|
+
|
30
|
+
color.red? # true
|
31
|
+
color.green? # false
|
32
|
+
```
|
33
|
+
|
34
|
+
### Values
|
35
|
+
|
36
|
+
Literal Enums can also be defined with values:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
class Color < Enum
|
40
|
+
Red("ff0000")
|
41
|
+
Green("00ff00")
|
42
|
+
Blue("0000ff")
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
Then we can look up all the values.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
Color.values # returns a Set of "ff0000", "00ff00", "0000f".
|
50
|
+
```
|
51
|
+
|
52
|
+
We can also look at the value for any member directly.
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
Color::Red.value # returns "ff0000"
|
56
|
+
```
|
57
|
+
|
58
|
+
Additionally, we can cast an Enum member from its value:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
Color.cast("ff0000") # returns Color::Red
|
62
|
+
```
|
63
|
+
|
64
|
+
### Singletons
|
65
|
+
|
66
|
+
When defining an enumeration, we can optionally provide a block that allows us to define methods on the singleton member. An example use-case might be a Switch that can be toggled On and Off. Whichever state its in, `toggle` will return the other state.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
class Switch < Enum
|
70
|
+
On do
|
71
|
+
def toggle
|
72
|
+
Off
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
Off do
|
77
|
+
def toggle
|
78
|
+
On
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
Switch::On.toggle # returns Switch::Off
|
84
|
+
Switch::Off.toggle # returns Switch::On
|
85
|
+
```
|
86
|
+
|
87
|
+
### State machine
|
88
|
+
|
89
|
+
It is also possible to define a more complex state machine by defining `transitions_to` methods on member singletons.
|
90
|
+
|
91
|
+
```ruby
|
92
|
+
class State < Enum
|
93
|
+
Unprocessed do
|
94
|
+
def transitions_to
|
95
|
+
[Validated, Errored]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
Validated do
|
100
|
+
def transitions_to
|
101
|
+
[Published, Errored]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
Published do
|
106
|
+
def transitions_to
|
107
|
+
[Processed, Errored]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
Processed()
|
112
|
+
Errored()
|
113
|
+
end
|
114
|
+
```
|
115
|
+
|
116
|
+
Given the above definition, we can transition from one state to another by calling `transition_to` with the newly desired state. This will raise a `LiteralEnums::TransitionError` if the transition is invalid.
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
State::Unprocessed.transition_to(State::Validated) # returns State::Validated.
|
120
|
+
State::Unprocessed.transition_to(State::Processed) # raises a LiteralEnums::TransitionError.
|
121
|
+
```
|
122
|
+
|
123
|
+
Alternatively, we can call the new state as a method on the old state.
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
State::Unprocessed.validated # returns State::Validated.
|
127
|
+
```
|
128
|
+
|
129
|
+
An invalid transition will return a `NoMethodErorr` in this case as the method is not defined.
|
130
|
+
|
131
|
+
The advantage of using method calls to transition from one state to anotehr is the method calls can be chained.
|
132
|
+
|
133
|
+
```ruby
|
134
|
+
State::Unprocessed.validated.processed # returns State::Processed, since it's valid to
|
135
|
+
# move to State::Processed from State::Validated and it's
|
136
|
+
# valid to move to State::Validated from State::Unprocessed.
|
137
|
+
```
|
138
|
+
|
139
|
+
## Installation
|
140
|
+
|
141
|
+
Add this line to your application's Gemfile:
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
gem "literal_enums"
|
145
|
+
```
|
146
|
+
|
147
|
+
And then execute:
|
148
|
+
|
149
|
+
$ bundle
|
150
|
+
|
151
|
+
Or install it yourself as:
|
152
|
+
|
153
|
+
$ gem install literal_enums
|
154
|
+
|
155
|
+
### Rails
|
156
|
+
|
157
|
+
Literal Enums are compatible with Rails. Please see `literal_enums-rails`.
|
158
|
+
|
159
|
+
## Development
|
160
|
+
|
161
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
162
|
+
|
163
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
164
|
+
|
165
|
+
## Contributing
|
166
|
+
|
167
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/joeldrapper/literal_enums. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
168
|
+
|
169
|
+
## License
|
170
|
+
|
171
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
172
|
+
|
173
|
+
## Code of Conduct
|
174
|
+
|
175
|
+
Everyone interacting in the LiteralEnums project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/joeldrapper/literal_enums/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "literal_enums"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/enum.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
class Enum
|
2
|
+
include LiteralEnums::Transitions
|
3
|
+
|
4
|
+
attr_reader :name, :value
|
5
|
+
|
6
|
+
alias_method :to_s, :value
|
7
|
+
alias_method :inspect, :name
|
8
|
+
|
9
|
+
def initialize(name, value)
|
10
|
+
@name = "#{self.class.name}::#{name}"
|
11
|
+
@value = value || @name
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def method_missing(name, *args, **kwargs, &block)
|
16
|
+
return super unless name[0] == name[0].upcase
|
17
|
+
new(name, *args, **kwargs, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def cast(value)
|
21
|
+
members.find { |v| v.value == value.to_s }
|
22
|
+
end
|
23
|
+
|
24
|
+
def values
|
25
|
+
members.map(&:value).to_set
|
26
|
+
end
|
27
|
+
|
28
|
+
def each(&block)
|
29
|
+
members.each(&block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def members
|
33
|
+
constants.map { |c| const_get(c) }.to_set
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def new(name, value = nil, &block)
|
39
|
+
if self == Enum
|
40
|
+
raise ArgumentError, "You can't add values to the abstract Enum class itself."
|
41
|
+
end
|
42
|
+
|
43
|
+
if constants.include?(name)
|
44
|
+
raise ArgumentError, "Name conflict: '#{self.name}::#{name}' is already defined."
|
45
|
+
end
|
46
|
+
|
47
|
+
if values.include?(value)
|
48
|
+
raise ArgumentError, "Value conflict: the value '#{value}' is defined for '#{self.cast(value).name}'."
|
49
|
+
end
|
50
|
+
|
51
|
+
member = super(name, value)
|
52
|
+
member.instance_eval(&block) if block_given?
|
53
|
+
|
54
|
+
class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
55
|
+
def #{name.to_s.underscore}?
|
56
|
+
name.demodulize.underscore == "#{name.to_s.underscore}"
|
57
|
+
end
|
58
|
+
RUBY
|
59
|
+
|
60
|
+
const_set(name, member.freeze)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module LiteralEnums
|
2
|
+
module Transitions
|
3
|
+
def respond_to_missing?(name, include_private = false)
|
4
|
+
return false if name == :transitions_to
|
5
|
+
valid_next_states.any? { |m| m.name.to_s.demodulize.underscore.to_sym == name }
|
6
|
+
end
|
7
|
+
|
8
|
+
def method_missing(name, *args, **kwargs, &block)
|
9
|
+
valid_next_states.find { |m| m.name.to_s.demodulize.underscore.to_sym == name } || super
|
10
|
+
end
|
11
|
+
|
12
|
+
def transition_to(new_state)
|
13
|
+
return new_state if can_transition_to?(new_state)
|
14
|
+
|
15
|
+
raise TransitionError, "You can't transition from #{self.name} to #{new_state.name}."
|
16
|
+
end
|
17
|
+
|
18
|
+
def can_transition_to?(new_state)
|
19
|
+
unless new_state.is_a?(self.class)
|
20
|
+
raise ArgumentError "You can only transition to another #{self.class.name}."
|
21
|
+
end
|
22
|
+
|
23
|
+
valid_next_states.include?(new_state)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def valid_next_states
|
29
|
+
return Array(transitions_to) if respond_to? :transitions_to
|
30
|
+
[]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "active_support"
|
2
|
+
require "active_support/core_ext/string"
|
3
|
+
|
4
|
+
require "literal_enums/version"
|
5
|
+
require "literal_enums/transitions"
|
6
|
+
require "enum"
|
7
|
+
|
8
|
+
module LiteralEnums
|
9
|
+
class Error < StandardError; end
|
10
|
+
class TransitionError < Error; end
|
11
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "literal_enums/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "literal_enums"
|
8
|
+
spec.version = LiteralEnums::VERSION
|
9
|
+
spec.authors = ["Joel Drapper"]
|
10
|
+
spec.email = ["joel@drapper.me"]
|
11
|
+
|
12
|
+
spec.summary = "Literal Enums syntax for Ruby"
|
13
|
+
spec.description = "A comprehensive Enum library for Ruby with literal-style syntax."
|
14
|
+
spec.homepage = "https://github.com/joeldrapper/literal_enums"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/joeldrapper/literal_enums"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/joeldrapper/literal_enums"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 2.3.7"
|
32
|
+
spec.add_development_dependency "rake", "~> 12.3.3"
|
33
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
34
|
+
|
35
|
+
spec.add_dependency "activesupport", "~> 7.0.2.2"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: literal_enums
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joel Drapper
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.3.7
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.3.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 12.3.3
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 12.3.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 7.0.2.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 7.0.2.2
|
69
|
+
description: A comprehensive Enum library for Ruby with literal-style syntax.
|
70
|
+
email:
|
71
|
+
- joel@drapper.me
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".github/workflows/ruby.yml"
|
77
|
+
- ".gitignore"
|
78
|
+
- ".ruby-version"
|
79
|
+
- CODE_OF_CONDUCT.md
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/enum.rb
|
88
|
+
- lib/literal_enums.rb
|
89
|
+
- lib/literal_enums/transitions.rb
|
90
|
+
- lib/literal_enums/version.rb
|
91
|
+
- literal_enums.gemspec
|
92
|
+
homepage: https://github.com/joeldrapper/literal_enums
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata:
|
96
|
+
homepage_uri: https://github.com/joeldrapper/literal_enums
|
97
|
+
source_code_uri: https://github.com/joeldrapper/literal_enums
|
98
|
+
changelog_uri: https://github.com/joeldrapper/literal_enums
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubygems_version: 3.3.7
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Literal Enums syntax for Ruby
|
118
|
+
test_files: []
|