struggle 1.1.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af26ed68fb6fa7c5b83d7a822184485f63fdf0f4
4
- data.tar.gz: d3ff71e8229203ebc043181df16dc714d45c091f
3
+ metadata.gz: 990165d7da9c6b831f844979b603b0ccac74bc6b
4
+ data.tar.gz: e4c4bc821530f93cd78dff57048fc25e48df45fe
5
5
  SHA512:
6
- metadata.gz: 02a647d55b9ef470ed208d3060b3fc78f37507859270763bbb615034369062ba6cdb56e0d913ed6eab5a5ea0e5e2170ae1b3c1a447bd889dd26bff487e3595e5
7
- data.tar.gz: 1057c15f4f4708c88bc8744e034265a675369409b90ef813a264636a3daaea608b888765801e0f10ff2b5bbe7166a4cbe4e7c98feed8ce6164bf70c8437b8333
6
+ metadata.gz: d2057514f417826fad1ae22cf591c1ec2af2b4de55dbe08663b0ad22fa43498e92d099441bd794c32ccaef0173c8c6ad5a890cca482ba987dc65193bd5b44657
7
+ data.tar.gz: 8a4c4a9d1b1ad7cdb6653ad98ad267be05bd7e04d42511eeaa6f2abe1145b72876b7eb7f8123dd9a27bd48f92c1124778b45e25b763755041a1a46204cdd864b
data/lib/struggle/func.rb CHANGED
@@ -71,7 +71,7 @@ module Struggle
71
71
  require 'uri'
72
72
 
73
73
  # get请求
74
- # 参数url:网址,header:请求头json类型如:{'Accept' => 'application/json', 'X-Requested-With' => 'XMLHttpRequest'}
74
+ # 参数url:网址,params:参数,header:请求头json类型如:{'Accept' => 'application/json', 'X-Requested-With' => 'XMLHttpRequest'}
75
75
  # 返回response对象,response.code 状态200/304/404;response.body 内容
76
76
  def self.get(url, params=nil, header=nil)
77
77
  uri = URI.parse(url)
@@ -87,6 +87,9 @@ module Struggle
87
87
  http.request(request)
88
88
  end
89
89
 
90
+ # post请求
91
+ # 参数url:网址,params:参数,header:请求头json类型如:{'Accept' => 'application/json', 'X-Requested-With' => 'XMLHttpRequest'}
92
+ # 返回response对象,response.code 状态200/304/404;response.body 内容
90
93
  def self.post(url, params=nil, header=nil)
91
94
  uri = URI.parse(url)
92
95
  http = Net::HTTP.new(uri.host, uri.port)
@@ -0,0 +1,8 @@
1
+ module HtmlExtend
2
+ module Help
3
+ def html_clear_extend(attr)
4
+ HtmlExtend.set_eval_str "self.#{attr}=html_clear(self.#{attr})"
5
+ before_save :save_extend
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,22 @@
1
+ module HtmlExtend
2
+ module Model
3
+ def save_extend
4
+ eval HtmlExtend.get_eval_str
5
+ end
6
+
7
+ #删除script标签
8
+ def script_clear(html)
9
+ html.gsub(/<script.*?<\/script>/, "")
10
+ end
11
+
12
+ #删除iframe标签
13
+ def iframe_clear(html)
14
+ html.gsub(/<iframe.*?<\/iframe>/, "")
15
+ end
16
+
17
+ #删除script标签,删除iframe标签
18
+ def html_clear(html)
19
+ html.gsub(/<script.*?<\/script>/, "").gsub(/<iframe.*?<\/iframe>/, "")
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ module HtmlExtend
2
+ def self.set_eval_str(evalStr)
3
+ @evalStr = evalStr
4
+ end
5
+
6
+ def self.get_eval_str
7
+ @evalStr
8
+ end
9
+ end
data/lib/struggle.rb CHANGED
@@ -13,3 +13,7 @@ require 'struggle/pay_gateway'
13
13
  require 'struggle/sms'
14
14
  require 'struggle/tmagick'
15
15
  require 'struggle/vcode'
16
+ require 'struggle/html_extend/help'
17
+ ActiveRecord::Base.send :extend, HtmlExtend::Help
18
+ require 'struggle/html_extend/model'
19
+ ActiveRecord::Base.send :include, HtmlExtend::Model
data/struggle.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'struggle'
3
- s.version = '1.1.0'
4
- s.date = '2015-06-24'
3
+ s.version = '1.3.0'
4
+ s.date = '2015-07-13'
5
5
  s.summary = "struggle!"
6
- s.description = "vcode,fileupload,pager,func,logistics,pay_gateway,tmagick;"
6
+ s.description = "vcode,fileupload,pager,func,logistics,pay_gateway,tmagick,html_extend;"
7
7
  s.authors = ["lean"]
8
8
  s.email = '54850915@qq.com'
9
9
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,44 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: struggle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iconv
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rmagick
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: vcode,fileupload,pager,func,logistics,pay_gateway,tmagick;
41
+ description: vcode,fileupload,pager,func,logistics,pay_gateway,tmagick,html_extend;
42
42
  email: 54850915@qq.com
43
43
  executables: []
44
44
  extensions: []
@@ -49,6 +49,9 @@ files:
49
49
  - lib/struggle.rb
50
50
  - lib/struggle/fileupload.rb
51
51
  - lib/struggle/func.rb
52
+ - lib/struggle/html_extend.rb
53
+ - lib/struggle/html_extend/help.rb
54
+ - lib/struggle/html_extend/model.rb
52
55
  - lib/struggle/logistics.rb
53
56
  - lib/struggle/pager.rb
54
57
  - lib/struggle/pay_gateway.rb
@@ -66,17 +69,17 @@ require_paths:
66
69
  - lib
67
70
  required_ruby_version: !ruby/object:Gem::Requirement
68
71
  requirements:
69
- - - ">="
72
+ - - '>='
70
73
  - !ruby/object:Gem::Version
71
74
  version: '0'
72
75
  required_rubygems_version: !ruby/object:Gem::Requirement
73
76
  requirements:
74
- - - ">="
77
+ - - '>='
75
78
  - !ruby/object:Gem::Version
76
79
  version: '0'
77
80
  requirements: []
78
81
  rubyforge_project:
79
- rubygems_version: 2.4.7
82
+ rubygems_version: 2.4.8
80
83
  signing_key:
81
84
  specification_version: 4
82
85
  summary: struggle!