atig 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/atig/gateway.rb +0 -1
- data/lib/atig/ifilter.rb +0 -1
- data/lib/atig/version.rb +1 -1
- metadata +4 -7
- data/lib/atig/ifilter/utf7.rb +0 -26
- data/spec/ifilter/utf7_spec.rb +0 -30
data/lib/atig/gateway.rb
CHANGED
data/lib/atig/ifilter.rb
CHANGED
data/lib/atig/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
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-05-
|
12
|
+
date: 2012-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
@@ -220,7 +220,6 @@ files:
|
|
220
220
|
- lib/atig/ifilter/retweet_time.rb
|
221
221
|
- lib/atig/ifilter/sanitize.rb
|
222
222
|
- lib/atig/ifilter/strip.rb
|
223
|
-
- lib/atig/ifilter/utf7.rb
|
224
223
|
- lib/atig/ifilter/xid.rb
|
225
224
|
- lib/atig/levenshtein.rb
|
226
225
|
- lib/atig/monkey.rb
|
@@ -279,7 +278,6 @@ files:
|
|
279
278
|
- spec/ifilter/sid_spec.rb
|
280
279
|
- spec/ifilter/strip_spec.rb
|
281
280
|
- spec/ifilter/tid_spec.rb
|
282
|
-
- spec/ifilter/utf7_spec.rb
|
283
281
|
- spec/levenshtein_spec.rb
|
284
282
|
- spec/ofilter/escape_url_spec.rb
|
285
283
|
- spec/ofilter/footer_spec.rb
|
@@ -303,7 +301,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
303
301
|
version: '0'
|
304
302
|
segments:
|
305
303
|
- 0
|
306
|
-
hash:
|
304
|
+
hash: 2969950395206530754
|
307
305
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
308
306
|
none: false
|
309
307
|
requirements:
|
@@ -312,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
312
310
|
version: '0'
|
313
311
|
segments:
|
314
312
|
- 0
|
315
|
-
hash:
|
313
|
+
hash: 2969950395206530754
|
316
314
|
requirements: []
|
317
315
|
rubyforge_project:
|
318
316
|
rubygems_version: 1.8.24
|
@@ -353,7 +351,6 @@ test_files:
|
|
353
351
|
- spec/ifilter/sid_spec.rb
|
354
352
|
- spec/ifilter/strip_spec.rb
|
355
353
|
- spec/ifilter/tid_spec.rb
|
356
|
-
- spec/ifilter/utf7_spec.rb
|
357
354
|
- spec/levenshtein_spec.rb
|
358
355
|
- spec/ofilter/escape_url_spec.rb
|
359
356
|
- spec/ofilter/footer_spec.rb
|
data/lib/atig/ifilter/utf7.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
-
|
3
|
-
require 'atig/util'
|
4
|
-
require "iconv"
|
5
|
-
|
6
|
-
module Atig
|
7
|
-
module IFilter
|
8
|
-
class Utf7
|
9
|
-
include Util
|
10
|
-
def initialize(context)
|
11
|
-
@log = context.log
|
12
|
-
end
|
13
|
-
|
14
|
-
def call(status)
|
15
|
-
return status unless defined? ::Iconv and status.text.include?("+")
|
16
|
-
|
17
|
-
status.merge :text => status.text.sub(/\A(?:.+ > |.+\z)/) { Iconv.iconv("UTF-8", "UTF-7", $&).join }
|
18
|
-
rescue Iconv::IllegalSequence
|
19
|
-
status
|
20
|
-
rescue => e
|
21
|
-
log :error,e
|
22
|
-
status
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/spec/ifilter/utf7_spec.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
-
|
3
|
-
require File.expand_path( '../../spec_helper', __FILE__ )
|
4
|
-
require 'atig/ifilter/utf7'
|
5
|
-
require 'atig/twitter_struct'
|
6
|
-
|
7
|
-
describe Atig::IFilter::Utf7 do
|
8
|
-
def filtered(text)
|
9
|
-
logger = mock('logger').should_receive(:error).at_most(:once)
|
10
|
-
ifilter = Atig::IFilter::Utf7.new(OpenStruct.new(:log=>logger,
|
11
|
-
:opts=>OpenStruct.new))
|
12
|
-
ifilter.call status(text)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should be used in Iconv" do
|
16
|
-
defined?(::Iconv).should be_true
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should through ASCII" do
|
20
|
-
filtered("hello").should be_text("hello")
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should decode +sequence" do
|
24
|
-
filtered("1 +- 1 = 2").should be_text("1 + 1 = 2")
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should decode pound sign" do
|
28
|
-
filtered("+AKM-1").should be_text("£1")
|
29
|
-
end
|
30
|
-
end
|