summaryrefslogtreecommitdiff
path: root/lib/actor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/actor.rb')
-rw-r--r--lib/actor.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/actor.rb b/lib/actor.rb
new file mode 100644
index 0000000..eab1bc4
--- /dev/null
+++ b/lib/actor.rb
@@ -0,0 +1,18 @@
+require_relative 'actor/base'
+require_relative 'actor/key'
+require_relative 'actor/user'
+
+module Actor
+ class UnsupportedActorError < StandardError; end
+
+ def self.new_from(str, audit_usernames: false)
+ case str
+ when Key.id_regex
+ Key.from(str, audit_usernames: audit_usernames)
+ when User.id_regex
+ User.from(str, audit_usernames: audit_usernames)
+ else
+ raise UnsupportedActorError
+ end
+ end
+end