ruby_ext 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rake_ext.rb +1 -1
- data/lib/rspec_ext.rb +10 -10
- data/lib/ruby_ext/core/hash.rb +5 -0
- data/lib/ruby_ext/core/module.rb +1 -1
- data/lib/ruby_ext/core/string.rb +4 -0
- data/lib/ruby_ext/core/time.rb +11 -0
- data/lib/ruby_ext/core.rb +1 -0
- metadata +3 -2
data/lib/rake_ext.rb
CHANGED
data/lib/rspec_ext.rb
CHANGED
@@ -128,13 +128,13 @@ end
|
|
128
128
|
#
|
129
129
|
# instance_stub
|
130
130
|
#
|
131
|
-
class Class
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
end
|
131
|
+
# class Class
|
132
|
+
# def instance_stub! &block
|
133
|
+
# new_method = method(:new)
|
134
|
+
# stub!(:new).and_return do |*args|
|
135
|
+
# instance = new_method.call(*args)
|
136
|
+
# block.call instance
|
137
|
+
# instance
|
138
|
+
# end
|
139
|
+
# end
|
140
|
+
# end
|
data/lib/ruby_ext/core/hash.rb
CHANGED
@@ -19,6 +19,11 @@ class Hash
|
|
19
19
|
raise "unknown options :#{unknown_options.join(': ')}!" unless unknown_options.empty?
|
20
20
|
end
|
21
21
|
|
22
|
+
# def inspect
|
23
|
+
# "{" + collect{|k, v| "#{k}: #{v}"}.join(', ') + "}"
|
24
|
+
# end
|
25
|
+
# alias_method :to_s, :inspect
|
26
|
+
|
22
27
|
alias_method :blank?, :empty?
|
23
28
|
alias_method :to_h, :to_hash
|
24
29
|
end
|
data/lib/ruby_ext/core/module.rb
CHANGED
@@ -118,7 +118,7 @@ Module.class_eval do
|
|
118
118
|
|
119
119
|
def attr_required *attrs
|
120
120
|
attrs.each do |attr|
|
121
|
-
define_method(attr){instance_variable_get(:"@#{attr}") || raise("attribute :#{attr} not defined!")}
|
121
|
+
define_method(attr){instance_variable_get(:"@#{attr}") || raise("attribute :#{attr} not defined on #{self}!")}
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
data/lib/ruby_ext/core/string.rb
CHANGED
data/lib/ruby_ext/core.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
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: 2011-
|
12
|
+
date: 2011-09-02 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/ruby_ext/core/open_object.rb
|
39
39
|
- lib/ruby_ext/core/string.rb
|
40
40
|
- lib/ruby_ext/core/symbol.rb
|
41
|
+
- lib/ruby_ext/core/time.rb
|
41
42
|
- lib/ruby_ext/core/true_class.rb
|
42
43
|
- lib/ruby_ext/core.rb
|
43
44
|
- lib/ruby_ext/fixes.rb
|