xrc 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/xrc/jid.rb +14 -3
- data/lib/xrc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6952d0813b9d1b9159181d4d8532b7b556c8a7a7
|
4
|
+
data.tar.gz: e32e5ac214c774fee8faf60f14a47233febf2745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbeaea3dd1cc0676183945d0b223983c7079d3619fc4780920b30a5447b4a2da869a1f68e067db8521ea7f7ad7d69c1c56b309081a4f3e7296d20d8babd17519
|
7
|
+
data.tar.gz: 728fd2d5273d1b3396a451e7e5be53e2619211a148e749c6cce29d3e0994eecfd9f2dfe6462081d892edf565762a831226249c82de75682813b88f28659afc85
|
data/CHANGELOG.md
CHANGED
data/lib/xrc/jid.rb
CHANGED
@@ -2,34 +2,45 @@ module Xrc
|
|
2
2
|
class Jid
|
3
3
|
PATTERN = /\A(?:([^@]*)@)??([^@\/]*)(?:\/(.*?))?\z/
|
4
4
|
|
5
|
+
attr_writer :node, :domain, :resource
|
6
|
+
|
5
7
|
attr_reader :raw
|
6
8
|
|
9
|
+
# @param [String] raw Jabber ID
|
10
|
+
# @example
|
11
|
+
# Xrc::Jid.new("alice@example.com/bot")
|
7
12
|
def initialize(raw)
|
8
13
|
@raw = raw
|
9
14
|
end
|
10
15
|
|
16
|
+
# @return [String] Node section (e.g. alice in alice@example.com/bot)
|
11
17
|
def node
|
12
|
-
sections[0]
|
18
|
+
@node ||= sections[0]
|
13
19
|
end
|
14
20
|
|
21
|
+
# @return [String] Domain section (e.g. example.com in alice@example.com/bot)
|
15
22
|
def domain
|
16
|
-
sections[1]
|
23
|
+
@domain ||= sections[1]
|
17
24
|
end
|
18
25
|
|
26
|
+
# @return [String, nil] Resource section, which can be omitted (e.g. bot in alice@example.com/bot)
|
19
27
|
def resource
|
20
|
-
sections[2]
|
28
|
+
@resource ||= sections[2]
|
21
29
|
end
|
22
30
|
|
31
|
+
# @return [String] Jabber ID without resource section
|
23
32
|
def strip
|
24
33
|
"#{node}@#{domain}"
|
25
34
|
end
|
26
35
|
|
36
|
+
# @return [String] Jabber ID, including resource section if any
|
27
37
|
def to_s
|
28
38
|
str = strip
|
29
39
|
str << "/#{resource}" if resource
|
30
40
|
str
|
31
41
|
end
|
32
42
|
|
43
|
+
# @return [true, false] True if given Jabber ID is same with self Jabber ID
|
33
44
|
def ==(jid)
|
34
45
|
jid = Jid.new(jid) unless jid.is_a?(Jid)
|
35
46
|
to_s == jid.to_s || strip == jid.strip
|
data/lib/xrc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xrc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|