zbox 0.1.1 → 0.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0db865c602b30d49f5ab40ccf554c3adf16a8fa496fafd640be28ffb1a7d70f9
4
- data.tar.gz: 3bb324b8a749a3d148fd705a6d9b5b68841a8bb53942f269582014f498f0c777
3
+ metadata.gz: 202c46dd8c1e0d4e712f365e4c29e47e2a0ba0078ad2f4d21712ac9ed75fe268
4
+ data.tar.gz: f043ea45896808ad99ddd25a01f78314a2bb00f867fe243801c2043ecd60ead3
5
5
  SHA512:
6
- metadata.gz: 9425b0c030364006e35777a57be9b43cf26dc7c04fa703ca5bf7a845b5879a6d86246e10ce9fa30d0f15d7ccd1de6230a87d10e076f1d782c079ef791e92a44e
7
- data.tar.gz: 7e721d5755950a77a00d30de5104db7a3da1fd2d98cb34a91e821d6e39a5b139becf498546e496948cdbffb1a63692848140ffb60c800214d56bdfd1d209c6e6
6
+ metadata.gz: f6356a27436e7d99c9d5931d6739bc69713630769c53797b1f0681cbdda0969645a46d7bfc3d824c131535be9b8b3a7b179b2fe005ca4a3c8e2505bfa335b89e
7
+ data.tar.gz: c6c95d9a3110d5454a9d66690a8f4351028d3471165dbe78c89472bc3cd132610530f1ce60345de91384ac1224396bbf85b4cda88056510a70f8f05ef69f528a
@@ -1,5 +1,5 @@
1
1
  module Zbox
2
- autoload :Qm, "zbox/img/qm"
2
+ # autoload :Qm, "zbox/img/qm"
3
3
  end
4
4
 
5
5
  Dir[File.join(File.dirname(__FILE__), 'zbox', 'ext', '*.rb')].each do |extension|
@@ -1,3 +1,3 @@
1
1
  module Zbox
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - zxy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-08 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: quick_magick
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0'
11
+ date: 2019-04-25 00:00:00.000000000 Z
12
+ dependencies: []
27
13
  description: zxy's ruby tool collections'
28
14
  email:
29
15
  - zxy@qq.com
@@ -36,12 +22,9 @@ files:
36
22
  - lib/zbox.rb
37
23
  - lib/zbox/ext/array.rb
38
24
  - lib/zbox/ext/hash.rb
39
- - lib/zbox/ext/mongoid.rb
40
25
  - lib/zbox/ext/numeric.rb
41
- - lib/zbox/ext/plug.rb
42
26
  - lib/zbox/ext/struct.rb
43
27
  - lib/zbox/ext/time.rb
44
- - lib/zbox/img/qm.rb
45
28
  - lib/zbox/version.rb
46
29
  homepage: http://lajunta.qq.com/
47
30
  licenses:
@@ -63,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
46
  version: '0'
64
47
  requirements: []
65
48
  rubyforge_project:
66
- rubygems_version: 2.7.7
49
+ rubygems_version: 2.7.3
67
50
  signing_key:
68
51
  specification_version: 4
69
52
  summary: zxy's ruby toolbox'
@@ -1,56 +0,0 @@
1
- module Mongoid
2
- module Mongoid::Document
3
-
4
- def self.included(base)
5
- base.include(InstanceMethods)
6
- base.extend(ClassMethods)
7
- end
8
-
9
- module InstanceMethods
10
- # remove medias within the content
11
- def delete_medias(content)
12
- doc = Nokogiri::HTML(eval("self.#{content.to_s}"))
13
- #doc = Nokogiri::HTML(self.content)
14
- images = doc.css("img[src*='/see/']")
15
- if images.count>0
16
- images.each do |image|
17
- grid_id = image["src"].split("/")[2]
18
- MongoGrid.remove(grid_id)
19
- end
20
- end
21
- end
22
- end
23
-
24
- module ClassMethods
25
- def method_missing(name,*args)
26
- if name.to_s =~ /^remove_(.*)$/
27
- # if name is pluralize
28
- if name.to_s.pluralize == name.to_s
29
- return self.class_eval(%Q{
30
- define_method("remove_#{$1}") do
31
- grid_files=self.#{$1}
32
- grid_files.each do |grid_file|
33
- id = BSON::ObjectId.from_string(grid_file['grid_id'])
34
- MongoGrid.grid.delete(id)
35
- end
36
- end
37
- })
38
- else
39
- # name is singlular
40
- return self.class_eval(%Q{
41
- define_method("remove_#{$1}") do
42
- grid_file=self.#{$1}
43
- unless grid_file.blank?
44
- id = BSON::ObjectId.from_string(grid_file['grid_id'])
45
- MongoGrid.grid.delete(id)
46
- end
47
- end
48
- })
49
- end
50
- else
51
- puts "No this method"
52
- end
53
- end
54
- end
55
- end
56
- end
@@ -1,24 +0,0 @@
1
- module Plug
2
- module Mixin
3
-
4
- def self.included(base)
5
- base.extend(ClassMethods)
6
- end
7
-
8
-
9
- module ClassMethods
10
- def array_attr(attr)
11
- attr = attr.to_s
12
- self.class_eval(%Q{
13
- def #{attr}_list
14
- return "" if self.#{attr}.blank?
15
- self.#{attr}.join(",")
16
- end
17
- def #{attr}_list=(value)
18
- self.#{attr} = value.split(",") if !value.blank?
19
- end
20
- })
21
- end
22
- end
23
- end
24
- end
@@ -1,21 +0,0 @@
1
- require "quick_magick"
2
- module Zbox
3
- module Qm
4
- def self.resize(filepath,opts={})
5
- img = QuickMagick::Image.open(filepath).first
6
- if opts[:width]
7
- mw = opts[:width]
8
- elsif opts[:height]
9
- mh = opts[:height]
10
- end
11
- mw ||= img.width
12
- mh ||= img.height
13
- if opts[:percent]
14
- img.resize opts[:percent]
15
- else
16
- img.resize "#{mw}x#{mh}"
17
- end
18
- img.save!
19
- end
20
- end
21
- end