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 CHANGED
@@ -27,7 +27,7 @@ begin
27
27
  desc "Finds Specifications"
28
28
  task :find_and_specs do
29
29
  RSpec::Core::RakeTask.new('spec') do |t|
30
- t.pattern = "spec/[^_]**/[^_]*_spec.rb"
30
+ t.pattern = "spec/**/[^_]*_spec.rb"
31
31
  end
32
32
  end
33
33
 
data/lib/rspec_ext.rb CHANGED
@@ -128,13 +128,13 @@ end
128
128
  #
129
129
  # instance_stub
130
130
  #
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
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
@@ -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
@@ -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
 
@@ -1,4 +1,8 @@
1
1
  String.class_eval do
2
+ def rsplit *args
3
+ reverse.split(*args).collect(&:reverse).reverse
4
+ end
5
+
2
6
  def dirname
3
7
  File.expand_path(File.dirname(self))
4
8
  end
@@ -0,0 +1,11 @@
1
+ class Time
2
+ def eql? o
3
+ return true if equal?(o)
4
+ self.class == o and self == o
5
+ end
6
+
7
+ def == o
8
+ return true if equal?(o)
9
+ o.respond_to?(:to_i) and to_i == o.to_i
10
+ end
11
+ end
data/lib/ruby_ext/core.rb CHANGED
@@ -17,5 +17,6 @@ require 'ruby_ext/fixes'
17
17
  must
18
18
  open_object
19
19
  deep_clone
20
+ time
20
21
  multiple_inheritance
21
22
  ).each{|f| require "ruby_ext/core/#{f}"}
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.3
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-08-24 00:00:00.000000000Z
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