Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4b6796aa
Commit
4b6796aa
authored
Jan 14, 2021
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip KeyCollisionError's implementation
parent
e6efedc9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
lib/declarative_enum.rb
lib/declarative_enum.rb
+2
-6
No files found.
lib/declarative_enum.rb
View file @
4b6796aa
...
...
@@ -76,11 +76,7 @@ module DeclarativeEnum
end
class
Builder
class
KeyCollisionError
<
StandardError
def
initialize
(
key
)
super
(
"`
#{
key
}
` collides with an existing enum key!"
)
end
end
KeyCollisionError
=
Class
.
new
(
StandardError
)
def
initialize
(
definition
,
block
)
@definition
=
definition
...
...
@@ -96,7 +92,7 @@ module DeclarativeEnum
private
def
method_missing
(
name
,
*
arguments
,
value:
nil
,
description:
nil
,
&
block
)
raise
KeyCollisionError
.
new
(
name
)
if
@definition
[
name
.
downcase
.
to_sym
]
raise
KeyCollisionError
,
"'
#{
key
}
' collides with an existing enum key!"
if
@definition
[
name
.
downcase
.
to_sym
]
@definition
[
name
.
downcase
.
to_sym
]
=
{
value:
value
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment