resque_def 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e97978c1e1e7b7361fc20e62cdad2791d0fc205b
4
- data.tar.gz: 4b134ee7cc1316f0052076bb17af5376751798fd
3
+ metadata.gz: 9c3404884d923b927c5b92b85eb7915a73bb6ac8
4
+ data.tar.gz: 8ed1f86604aa745923a7a90dba35c6f73f49d52a
5
5
  SHA512:
6
- metadata.gz: fc5c45d2c0177dd2b82d2926b6197c2d3efdafcbd3c4395a7b0d42867ae510e92cb96dbcc8175933f557271ac2c8d1c40ab35d50fd295d1566719744f573e74d
7
- data.tar.gz: d302af7e191e301010cf95060cda342f69011d884f67e3ea4854fd73472fcad09329fad0acdc268805d39061229528fa1adb995de2fe4419f2323c6e82ba7b98
6
+ metadata.gz: 7005e15765fecb153f11e9c7d823cada909bbaafd20f2bec5cec7c54ee6e37c4bcb7475085e46bd8a9f5e8f7b89595337c39c0038c0380294da84f1deb7d2767
7
+ data.tar.gz: b712746e20cb800521b4e5e19b3656b57ec45b20673ff12c16cf61045b9c936309407f68a97f997bf9df75954cec466c7c3fa58589c3dafd5a5b091fef70b039
data/.gitignore CHANGED
@@ -2,5 +2,4 @@
2
2
  test/fixtures/repos/*
3
3
  *.gem
4
4
 
5
-
6
5
  Gemfile.lock
@@ -0,0 +1,7 @@
1
+ ## 0.0.2
2
+
3
+ Allow early returns from blocks.
4
+
5
+ ## 0.0.1
6
+
7
+ - Initial commit
@@ -8,6 +8,12 @@ module ResqueDef
8
8
  # convert resque_name like :delay_send_issues to DelaySendIssues for klass name
9
9
  resque_klass_name = resque_name.to_s.capitalize.gsub(/_\S/) {|m| m.upcase}.gsub('_', '')
10
10
 
11
+
12
+ # convert proc to lambda :(
13
+ obj = Object.new
14
+ obj.define_singleton_method(:_, &block)
15
+ block = obj.method(:_).to_proc
16
+
11
17
  # create the resque klass
12
18
  resque_klass = Class.new do
13
19
  @queue = resque_name
@@ -1,3 +1,3 @@
1
1
  module ResqueDef
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -18,4 +18,10 @@ class ResqueDefTest < Test::Unit::TestCase
18
18
  User.bar("a", "b", "c")
19
19
  User.new.bar("a", "b", "c")
20
20
  end
21
+
22
+ def test_early_returns
23
+ Foo.expects(:bar).once
24
+ Foo.early_return_if false
25
+ Foo.early_return_if true
26
+ end
21
27
  end
@@ -38,4 +38,9 @@ class Foo
38
38
  resque_def :bar do |*args|
39
39
  Foo.bar(*args)
40
40
  end
41
+
42
+ resque_def :early_return_if do |bool|
43
+ return true if bool
44
+ Foo.bar
45
+ end
41
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque_def
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
@@ -60,8 +60,8 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - .gitignore
63
+ - CHANGELOG.md
63
64
  - Gemfile
64
- - Gemfile.lock
65
65
  - README.md
66
66
  - Rakefile
67
67
  - lib/resque_def.rb