ircp 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ircp/message.rb CHANGED
@@ -19,16 +19,7 @@ module Ircp
19
19
  end
20
20
 
21
21
  def to_irc
22
- if @raw.nil? || @raw.empty?
23
- tokens = []
24
- tokens << @prefix
25
- tokens << @command
26
- @params.each { |param| tokens << param }
27
- msg = tokens.delete_if { |token| token.nil? || token.empty? }.join(' ')
28
- else
29
- msg = @raw.to_s
30
- end
31
-
22
+ msg = [@prefix, @command, *@params].map { |v| v.to_s }.reject { |v| v.empty? }.join(' ')
32
23
  msg << "\r\n" unless msg.end_with?("\r\n")
33
24
  msg
34
25
  end
data/lib/ircp/prefix.rb CHANGED
@@ -21,18 +21,12 @@ module Ircp
21
21
  end
22
22
 
23
23
  def to_irc
24
- if @raw.nil? || @raw.empty?
25
- if @servername
26
- ":#{servername}"
27
- else
28
- tokens = []
29
- tokens << ":#{@nick}" unless @nick.nil?
30
- tokens << "!#{@user}" unless @user.nil?
31
- tokens << "@#{@host}" unless @host.nil?
32
- tokens.join ''
33
- end
24
+ if @servername
25
+ ":#{servername}"
34
26
  else
35
- @raw.to_s
27
+ [[':', @nick], ['!', @user], ['@', @host]].map do |mark, value|
28
+ "#{mark}#{value}" unless value.to_s.empty?
29
+ end.compact.join('')
36
30
  end
37
31
  end
38
32
  alias_method :to_s, :to_irc
data/lib/ircp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ircp
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ircp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-24 00:00:00.000000000 Z
12
+ date: 2012-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: treetop
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  segments:
101
101
  - 0
102
- hash: -4246548536809339078
102
+ hash: -4241097157584953199
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  none: false
105
105
  requirements:
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: -4246548536809339078
111
+ hash: -4241097157584953199
112
112
  requirements: []
113
113
  rubyforge_project:
114
114
  rubygems_version: 1.8.21