tengine_support 0.3.22 → 0.3.24
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.
- data/Gemfile +3 -0
- data/VERSION +1 -1
- data/gemfiles/Gemfile.activesupport-3.0.10 +3 -0
- data/gemfiles/Gemfile.activesupport-3.1.1 +3 -0
- data/lib/tengine/support/core_ext/enumerable/deep_freeze.rb +15 -0
- data/lib/tengine/support/core_ext/enumerable/each_next_tick.rb +21 -0
- data/lib/tengine/support/core_ext/enumerable.rb +7 -0
- data/lib/tengine/support/core_ext/hash/compact.rb +15 -0
- data/lib/tengine/support/core_ext/hash/keys.rb +1 -0
- data/lib/tengine/support/core_ext/module/private_constant.rb +9 -0
- data/lib/tengine/support/core_ext/module.rb +7 -0
- data/spec/tengine/support/core_ext/enumerable/deep_freeze_spec.rb +16 -0
- data/spec/tengine/support/core_ext/enumerable/each_next_tick_spec.rb +29 -0
- data/spec/tengine/support/core_ext/hash/compact_spec.rb +28 -0
- data/tengine_support.gemspec +11 -2
- metadata +28 -19
data/Gemfile
CHANGED
@@ -4,6 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
5
|
|
6
6
|
gem "activesupport", ">= 3.0.0"
|
7
|
+
group :test do
|
8
|
+
gem "eventmachine", "~> 0.12.0"
|
9
|
+
end
|
7
10
|
|
8
11
|
# Add dependencies to develop your gem here.
|
9
12
|
# Include everything needed to run rake, tests, features, etc.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.24
|
@@ -4,6 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
5
|
|
6
6
|
gem "activesupport", "= 3.0.10"
|
7
|
+
group :test do
|
8
|
+
gem "eventmachine", "~> 0.12.0"
|
9
|
+
end
|
7
10
|
|
8
11
|
# Add dependencies to develop your gem here.
|
9
12
|
# Include everything needed to run rake, tests, features, etc.
|
@@ -4,6 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
# gem "activesupport", ">= 2.3.5"
|
5
5
|
|
6
6
|
gem "activesupport", "= 3.1.1"
|
7
|
+
group :test do
|
8
|
+
gem "eventmachine", "~> 0.12.0"
|
9
|
+
end
|
7
10
|
|
8
11
|
# Add dependencies to develop your gem here.
|
9
12
|
# Include everything needed to run rake, tests, features, etc.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'eventmachine'
|
2
|
+
|
3
|
+
module Enumerable
|
4
|
+
|
5
|
+
# ``You are not expected to understand this. ... The real problem is
|
6
|
+
# that we didn't understand what was going on either.''
|
7
|
+
# Dennis Ritcie
|
8
|
+
def each_next_tick
|
9
|
+
raise ArgumentError, "no block given" unless block_given?
|
10
|
+
nop = lambda do end
|
11
|
+
self.reverse_each.inject nop do |block, obj|
|
12
|
+
lambda do
|
13
|
+
EM.next_tick do
|
14
|
+
yield obj
|
15
|
+
block.call
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end.call
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path('../../../../spec_helper', File.dirname(__FILE__))
|
2
|
+
require "tengine/support/core_ext/enumerable/deep_freeze"
|
3
|
+
|
4
|
+
describe Enumerable do
|
5
|
+
describe "#deep_freeze" do
|
6
|
+
subject { { "q" => { "w" => { "e" => { "r" => { "t" => { "y" => "u" } } } } } }.deep_freeze }
|
7
|
+
it "recursive destructive freezing of the subject" do
|
8
|
+
subject["q"].frozen?.should be_true
|
9
|
+
subject["q"]["w"].frozen?.should be_true
|
10
|
+
subject["q"]["w"]["e"].frozen?.should be_true
|
11
|
+
subject["q"]["w"]["e"]["r"].frozen?.should be_true
|
12
|
+
subject["q"]["w"]["e"]["r"]["t"].frozen?.should be_true
|
13
|
+
subject["q"]["w"]["e"]["r"]["t"]["y"].frozen?.should be_true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.expand_path('../../../../spec_helper', File.dirname(__FILE__))
|
3
|
+
require "tengine/support/core_ext/enumerable/each_next_tick"
|
4
|
+
|
5
|
+
describe Enumerable do
|
6
|
+
describe "#each_next_tick" do
|
7
|
+
it "eachと同じ順にiterateする" do
|
8
|
+
str = ""
|
9
|
+
EM.run do
|
10
|
+
[1, 2, 3, 4].each_next_tick do |i|
|
11
|
+
str << i.to_s
|
12
|
+
end
|
13
|
+
EM.add_timer 0.1 do EM.stop end
|
14
|
+
end
|
15
|
+
str.should == "1234"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "next_tickでやる" do
|
19
|
+
str = ""
|
20
|
+
EM.run do
|
21
|
+
[1, 2, 3, 4].each_next_tick do |i|
|
22
|
+
str << i.to_s
|
23
|
+
end
|
24
|
+
str.should be_empty
|
25
|
+
EM.add_timer 0.1 do EM.stop end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper')
|
3
|
+
|
4
|
+
require 'active_support'
|
5
|
+
require "tengine/support/core_ext/hash/compact"
|
6
|
+
|
7
|
+
describe Hash do
|
8
|
+
describe "#compact!" do
|
9
|
+
it "Array#compat!と同じ" do
|
10
|
+
h = { :foo => :bar, :baz => nil }
|
11
|
+
h.compact!
|
12
|
+
h.should include(:foo)
|
13
|
+
h.should_not include(:baz)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#compact" do
|
18
|
+
it "非破壊的" do
|
19
|
+
h = { :foo => :bar, :baz => nil }
|
20
|
+
hh = h.compact
|
21
|
+
h.should include(:foo)
|
22
|
+
h.should include(:baz)
|
23
|
+
hh.should include(:foo)
|
24
|
+
hh.should_not include(:baz)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
data/tengine_support.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "tengine_support"
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.24"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["saishu", "w-irie", "taigou", "totty", "hiroshinakao", "g-morita", "guemon", "aoetk", "hattori-at-nt", "t-yamada", "y-karashima", "akm"]
|
12
|
-
s.date = "2011-
|
12
|
+
s.date = "2011-12-15"
|
13
13
|
s.description = "tengine_support provides utility classes/modules which is not included in active_support. It doesn't depend on other tengine gems."
|
14
14
|
s.email = "tengine@nautilus-technologies.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -40,9 +40,15 @@ Gem::Specification.new do |s|
|
|
40
40
|
"lib/tengine/support/core_ext.rb",
|
41
41
|
"lib/tengine/support/core_ext/array.rb",
|
42
42
|
"lib/tengine/support/core_ext/array/deep_dup.rb",
|
43
|
+
"lib/tengine/support/core_ext/enumerable.rb",
|
44
|
+
"lib/tengine/support/core_ext/enumerable/deep_freeze.rb",
|
45
|
+
"lib/tengine/support/core_ext/enumerable/each_next_tick.rb",
|
43
46
|
"lib/tengine/support/core_ext/hash.rb",
|
47
|
+
"lib/tengine/support/core_ext/hash/compact.rb",
|
44
48
|
"lib/tengine/support/core_ext/hash/deep_dup.rb",
|
45
49
|
"lib/tengine/support/core_ext/hash/keys.rb",
|
50
|
+
"lib/tengine/support/core_ext/module.rb",
|
51
|
+
"lib/tengine/support/core_ext/module/private_constant.rb",
|
46
52
|
"lib/tengine/support/null_logger.rb",
|
47
53
|
"lib/tengine/support/yaml_with_erb.rb",
|
48
54
|
"lib/tengine_support.rb",
|
@@ -61,6 +67,9 @@ Gem::Specification.new do |s|
|
|
61
67
|
"spec/tengine/support/config_spec/load_spec_02.yml.erb",
|
62
68
|
"spec/tengine/support/config_spec/parse_spec.rb",
|
63
69
|
"spec/tengine/support/core_ext/array/deep_dup_spec.rb",
|
70
|
+
"spec/tengine/support/core_ext/enumerable/deep_freeze_spec.rb",
|
71
|
+
"spec/tengine/support/core_ext/enumerable/each_next_tick_spec.rb",
|
72
|
+
"spec/tengine/support/core_ext/hash/compact_spec.rb",
|
64
73
|
"spec/tengine/support/core_ext/hash/deep_dup_spec.rb",
|
65
74
|
"spec/tengine/support/core_ext/hash/keys_spec.rb",
|
66
75
|
"spec/tengine/support/null_logger_spec.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tengine_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.24
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -20,11 +20,11 @@ authors:
|
|
20
20
|
autorequire:
|
21
21
|
bindir: bin
|
22
22
|
cert_chain: []
|
23
|
-
date: 2011-
|
23
|
+
date: 2011-12-15 00:00:00.000000000Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &2154838940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2154838940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &2154838160 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.6.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2154838160
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard
|
49
|
-
requirement: &
|
49
|
+
requirement: &2154837460 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.7.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2154837460
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &2154836660 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.18
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2154836660
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
|
-
requirement: &
|
71
|
+
requirement: &2154835480 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2154835480
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: simplecov
|
82
|
-
requirement: &
|
82
|
+
requirement: &2154834160 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.5.3
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2154834160
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: autotest
|
93
|
-
requirement: &
|
93
|
+
requirement: &2154832940 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2154832940
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: rdiscount
|
104
|
-
requirement: &
|
104
|
+
requirement: &2154831660 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2154831660
|
113
113
|
description: tengine_support provides utility classes/modules which is not included
|
114
114
|
in active_support. It doesn't depend on other tengine gems.
|
115
115
|
email: tengine@nautilus-technologies.com
|
@@ -142,9 +142,15 @@ files:
|
|
142
142
|
- lib/tengine/support/core_ext.rb
|
143
143
|
- lib/tengine/support/core_ext/array.rb
|
144
144
|
- lib/tengine/support/core_ext/array/deep_dup.rb
|
145
|
+
- lib/tengine/support/core_ext/enumerable.rb
|
146
|
+
- lib/tengine/support/core_ext/enumerable/deep_freeze.rb
|
147
|
+
- lib/tengine/support/core_ext/enumerable/each_next_tick.rb
|
145
148
|
- lib/tengine/support/core_ext/hash.rb
|
149
|
+
- lib/tengine/support/core_ext/hash/compact.rb
|
146
150
|
- lib/tengine/support/core_ext/hash/deep_dup.rb
|
147
151
|
- lib/tengine/support/core_ext/hash/keys.rb
|
152
|
+
- lib/tengine/support/core_ext/module.rb
|
153
|
+
- lib/tengine/support/core_ext/module/private_constant.rb
|
148
154
|
- lib/tengine/support/null_logger.rb
|
149
155
|
- lib/tengine/support/yaml_with_erb.rb
|
150
156
|
- lib/tengine_support.rb
|
@@ -163,6 +169,9 @@ files:
|
|
163
169
|
- spec/tengine/support/config_spec/load_spec_02.yml.erb
|
164
170
|
- spec/tengine/support/config_spec/parse_spec.rb
|
165
171
|
- spec/tengine/support/core_ext/array/deep_dup_spec.rb
|
172
|
+
- spec/tengine/support/core_ext/enumerable/deep_freeze_spec.rb
|
173
|
+
- spec/tengine/support/core_ext/enumerable/each_next_tick_spec.rb
|
174
|
+
- spec/tengine/support/core_ext/hash/compact_spec.rb
|
166
175
|
- spec/tengine/support/core_ext/hash/deep_dup_spec.rb
|
167
176
|
- spec/tengine/support/core_ext/hash/keys_spec.rb
|
168
177
|
- spec/tengine/support/null_logger_spec.rb
|
@@ -187,7 +196,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
196
|
version: '0'
|
188
197
|
segments:
|
189
198
|
- 0
|
190
|
-
hash: -
|
199
|
+
hash: -2124525039867493663
|
191
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
201
|
none: false
|
193
202
|
requirements:
|