ruby_extendsions 0.1.8.1 → 0.1.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,20 +1,20 @@
1
1
  module RubyExtendsions
2
2
  module ArrayExtendsions
3
- # def self.included(base)
4
- # base.send :include, InstanceMethods
5
- # base.send :extend, ClassMethods
6
- # end
7
- extend ActiveSupport::Concern
8
-
3
+ def self.included(base)
4
+ base.send :include, InstanceMethods
5
+ base.send :extend, ClassMethods
6
+ end
7
+ # extend ActiveSupport::Concern
8
+
9
9
  module InstanceMethods
10
10
  def fill_nil(val)
11
11
  self.inject([]) {|s, a| s << (a.nil? ? a=val : a)}
12
12
  end
13
-
13
+
14
14
  def fill_nil!(val)
15
15
  self.each_index { |i| self[i] ||= val }
16
16
  end
17
-
17
+
18
18
  #change [[1,2,3][4,5,6]] to ('1','2','3'),('4','5','6')
19
19
  #be used with mess insert mysql
20
20
  def format_mess_insert
@@ -23,7 +23,7 @@ module RubyExtendsions
23
23
  s << t << '),'
24
24
  end.chop
25
25
  end
26
-
26
+
27
27
  #whether the array is all nil item
28
28
  # like arr = [nil,nil,nil,nil]
29
29
  # arr.is_nil_all? #=> true
@@ -32,14 +32,14 @@ module RubyExtendsions
32
32
  self.each {|i| b = false if !i.nil? }
33
33
  return b
34
34
  end
35
-
35
+
36
36
  #for rails
37
37
  def is_blank_all?
38
38
  b = true
39
39
  self.each {|i| b = false if !i.blank? }
40
40
  return b
41
41
  end
42
-
42
+
43
43
  #Random return an Array item
44
44
  def random
45
45
  return self[rand(self.size)]
@@ -52,12 +52,12 @@ module RubyExtendsions
52
52
  e < self[m] ? u=m-1 : l=m+1
53
53
  e == self[m] ? m : binary_search_index(e,l,u)
54
54
  end
55
-
55
+
56
56
  # 基于二分查找的include?
57
57
  def b_include? e
58
58
  !self.binary_search_index(e).nil?
59
59
  end
60
-
60
+
61
61
  #比较两个数组内容相同
62
62
  def compare_content com_arr
63
63
  arr = Set.new self
@@ -66,11 +66,11 @@ module RubyExtendsions
66
66
  end
67
67
 
68
68
  end#InstanceMethods
69
-
69
+
70
70
  module ClassMethods
71
71
  #TODO
72
72
  end#ClassMethods
73
-
73
+
74
74
  end #HashExtendsions
75
75
  end #RubyExtendsions
76
76
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "ruby_extendsions"
5
- s.version = "0.1.8.1"
5
+ s.version = "0.1.8.2"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ["blackanger"]
8
8
  s.email = ["blackanger.z@gmail.com"]
@@ -14,7 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.rubyforge_project = "ruby_extendsions"
15
15
  s.add_development_dependency "bundler", ">= 1.0.0"
16
16
  s.add_development_dependency "rspec"
17
- s.add_development_dependency "rails", ">=3.0.5"
18
17
 
19
18
  s.files = `git ls-files`.split("\n")
20
19
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_extendsions
3
3
  version: !ruby/object:Gem::Version
4
- hash: 101
4
+ hash: 99
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
9
  - 8
10
- - 1
11
- version: 0.1.8.1
10
+ - 2
11
+ version: 0.1.8.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - blackanger
@@ -49,22 +49,6 @@ dependencies:
49
49
  version: "0"
50
50
  type: :development
51
51
  version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rails
54
- prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
56
- none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 13
61
- segments:
62
- - 3
63
- - 0
64
- - 5
65
- version: 3.0.5
66
- type: :development
67
- version_requirements: *id003
68
52
  description: Ruby Extendsions for rails 3.0.5+
69
53
  email:
70
54
  - blackanger.z@gmail.com