Skip to content

Commit

Permalink
extract Tag
Browse files Browse the repository at this point in the history
  • Loading branch information
kickster97 committed Jan 22, 2025
1 parent 6bd90cf commit de1b302
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 13 additions & 0 deletions src/lavinmq/tag.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module LavinMQ
enum Tag
Administrator
Monitoring
Management
PolicyMaker
Impersonator

def self.parse_list(list : String) : Array(Tag)
list.split(",").compact_map { |t| Tag.parse?(t.strip) }
end
end
end
13 changes: 1 addition & 12 deletions src/lavinmq/user.cr
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
require "json"
require "./password"
require "./sortable_json"
require "./tag"

module LavinMQ
enum Tag
Administrator
Monitoring
Management
PolicyMaker
Impersonator

def self.parse_list(list : String) : Array(Tag)
list.split(",").compact_map { |t| Tag.parse?(t.strip) }
end
end

class User
include SortableJSON
getter name, password, permissions
Expand Down

0 comments on commit de1b302

Please sign in to comment.