Last active
October 6, 2015 23:38
-
-
Save hoelzro/3071368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hexe::Stanza::Presence { | |
method new($obj) { | |
return self.bless(*); | |
} | |
} | |
class Hexe::Stanza::Message { | |
method new($obj) { | |
return self.bless(*); | |
} | |
} | |
class Hexe::Stanza { | |
method create($obj) { | |
given $obj<_tag> { | |
when 'presence' { | |
return Hexe::Stanza::Presence.new($obj); | |
} | |
when 'message' { | |
return Hexe::Stanza::Message.new($obj); | |
} | |
default { | |
return Failure("Unknown tag '$obj<_tag>'"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
don't forget that bless with a whatever star argument is now deprecated