simple_operation 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be62a1f7a0bc484ed7677f1dc1e57e46ccdf9e98
4
- data.tar.gz: f053b89a5992672f41831253df0f2a78a2a4bacf
3
+ metadata.gz: e7492ed2b8ed2e376b77f74c30765edcb7c54241
4
+ data.tar.gz: 67f8e2eece14bea9123482316603b318f0181b6e
5
5
  SHA512:
6
- metadata.gz: 9099903c40555203ff438dfcbd3c44ffee95b79ac0aafa1a81bef8276e7ba8ad034c25d504b198d29ae21cc07b8a049563ff1dc3e7d8ff92f26bad9d6d9939dd
7
- data.tar.gz: 7a3f1fd62e05bde3c74b9fa8be2c7a19aab7547ec405c67f2df25febb1ff0162651d75e18767be71af9e5890fab31c1ea7ec95f3275211509b7ad58e514857e2
6
+ metadata.gz: 34b2980275b3f2bf0be1c4438cbd82ac9357b09982f4e70712709fa3ef433e5cdb79162e2d179ab4741f2afd166cf2a3c3f5699f9b195f6996e2dc287db89ba8
7
+ data.tar.gz: a03a556846569e45151a3720b166541d3e3280f03afede0e264950f724ee28813ff5aa0bc6ec0a97e38d8952fccbf0f37c12fcd32cc08bfdb0647f0ded90ed6b
data/README.md CHANGED
@@ -45,7 +45,7 @@ CreateUser.('Grzegorz', 'arnvald.to@gmail.com')
45
45
  # the same effect as line above
46
46
  CreateUser.new('Grzegorz', 'arnvald.to@gmail.com').()
47
47
 
48
- # the same, but fits Rails ActiveJob's convention
48
+ # `perform` is an alias for `call`
49
49
  CreateUser.new('Grzegorz', 'arnvald.to@gmail.com').perform
50
50
  ```
51
51
 
@@ -1,9 +1,9 @@
1
- require "simple_operation/version"
1
+ require_relative './simple_operation/version'
2
2
 
3
3
  class SimpleOperation
4
4
 
5
5
  def self.new(*args)
6
- args_list_with_nils = args.join('=nil, ') + '=nil'
6
+ args_list_with_nils = args.empty? ? '' : "#{args.join('=nil,')}=nil"
7
7
  Class.new do
8
8
  class_eval <<-code
9
9
  def self.call #{args_list_with_nils}
@@ -0,0 +1,5 @@
1
+ module Kernel
2
+ def SimpleOperation(*args)
3
+ SimpleOperation.new(*args)
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  class SimpleOperation
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'simple_operation'
3
+ require 'simple_operation/ext'
4
+ require 'minitest/autorun'
5
+
6
+ class SimpleOperationExtTest < Minitest::Test
7
+
8
+ def test_creates_new_class
9
+ assert SimpleOperation(:login).is_a? Class
10
+ end
11
+
12
+ end
@@ -8,6 +8,10 @@ class SimpleOperationTest < Minitest::Test
8
8
  assert SimpleOperation.new(:login)
9
9
  end
10
10
 
11
+ def test_runs_correctly_with_no_params
12
+ assert SimpleOperation.new
13
+ end
14
+
11
15
  def test_has_no_public_readers
12
16
  assert_raises(NoMethodError) { object.login }
13
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_operation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grzegorz Witek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-15 00:00:00.000000000 Z
11
+ date: 2015-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,8 +52,10 @@ files:
52
52
  - README.md
53
53
  - Rakefile
54
54
  - lib/simple_operation.rb
55
+ - lib/simple_operation/ext.rb
55
56
  - lib/simple_operation/version.rb
56
57
  - simple_operation.gemspec
58
+ - test/simple_operation_ext_test.rb
57
59
  - test/simple_operation_test.rb
58
60
  homepage: ''
59
61
  licenses:
@@ -80,4 +82,6 @@ signing_key:
80
82
  specification_version: 4
81
83
  summary: Create simple service object
82
84
  test_files:
85
+ - test/simple_operation_ext_test.rb
83
86
  - test/simple_operation_test.rb
87
+ has_rdoc: