skates 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,8 +39,8 @@ module Skates
39
39
  protected
40
40
  def disco_for(type, node = nil)
41
41
  str = "//iq[@type='get']/*[namespace(., 'query', 'http://jabber.org/protocol/disco##{type.to_s}')"
42
- str += " and @node = '#{node}'" if node
43
- str += "]"
42
+ str << " and @node = '#{node}'" if node
43
+ str << "]"
44
44
  xpath(str)
45
45
  end
46
46
  end
@@ -149,26 +149,26 @@ module Skates
149
149
  ##
150
150
  # Sends the Nokogiri::XML data (after converting to string) on the stream. Eventually it displays this data for debugging purposes.
151
151
  def send_xml(xml)
152
- begin
153
- if xml.is_a? Nokogiri::XML::NodeSet
154
- xml.each do |element|
155
- send_chunk(element.to_s)
156
- end
157
- else
158
- send_chunk(xml.to_s)
159
- end
160
- rescue
161
- Skates.logger.error {
162
- "SENDING FAILED: #{$!}"
163
- }
164
- end
152
+ begin
153
+ if xml.is_a? Nokogiri::XML::NodeSet
154
+ xml.each do |element|
155
+ send_chunk(element.to_s)
156
+ end
157
+ else
158
+ send_chunk(xml.to_s)
159
+ end
160
+ rescue
161
+ Skates.logger.error {
162
+ "SENDING FAILED: #{$!}"
163
+ }
164
+ end
165
165
  end
166
-
166
+
167
167
  private
168
-
169
- def send_chunk(string)
168
+
169
+ def send_chunk(string = "")
170
170
  raise NotConnected unless @connected
171
- return if string.blank?
171
+ return if string == ""
172
172
  raise StanzaTooBig, "Stanza Too Big (#{string.length} vs. #{XmppConnection.max_stanza_size})\n #{string}" if string.length > XmppConnection.max_stanza_size
173
173
  Skates.logger.debug {
174
174
  "SENDING : " + string
@@ -32,7 +32,7 @@ module Skates
32
32
  # Adds characters to the current element (being parsed)
33
33
  def characters(string)
34
34
  @buffer ||= ""
35
- @buffer += string
35
+ @buffer << string
36
36
  end
37
37
 
38
38
  ##
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,7 @@
1
+ require 'templater'
2
+
1
3
  require File.dirname(__FILE__) + "/../lib/skates"
4
+ require File.dirname(__FILE__) + "/../lib/skates/generator"
2
5
 
3
6
  # #
4
7
  # Deactivate the logging
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 3
9
- version: 0.3.3
8
+ - 4
9
+ version: 0.3.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - julien Genestoux
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-16 00:00:00 +02:00
17
+ date: 2010-05-03 00:00:00 +02:00
18
18
  default_executable: skates
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency