skywalker 2.0.0 → 2.1.0

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: dee046be5564b0553dc68ccb39100a40156404fb
4
- data.tar.gz: afec05026a60744290c39d3fed58377864019dc1
3
+ metadata.gz: f34e5d3df438e1dded141d4b9e093785bb392cdd
4
+ data.tar.gz: e108b0e461eddb8f298ca5c771a0baf988e6c86f
5
5
  SHA512:
6
- metadata.gz: 8b1432945db2c162d1775d00e07e7c1373b463ef7db0ac921e0a75373b6e6da30f0352ace272bb1dc5286a16296b4297e155d0fdb49919fa3885ab33eb1e446e
7
- data.tar.gz: 4c5e09daaaceb2550c3a361181d83e6af830f527fa7a875afd05939d763711754e2129c1d6b9f74183955319025dda21e4457e364f2c39eb495831dbedcf67e7
6
+ metadata.gz: 2f0fe7a5edd3bc67f0478dc91369e10001ce9fb037a464cde6016241f202f1afc724d2b879e95e8198d1eda1663448984d9ec81e278df20687e65399f5f97f92
7
+ data.tar.gz: 53d3eff371345c36dbe9ea155a29fbbad8806743ddac162abfda4e8c3c9557b6a9df224f56c6cfe63d72b8ac83f807eb9f01075d3149242c6da024c6b8b7c99d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  All commits by Rob Yurkowski unless otherwise noted.
2
2
 
3
+ ## 2.1.0 (2015-05-14)
4
+
5
+ - Yields self to any block given to any object implementing `Skywalker::Acceptable`.
6
+
7
+ This has a few ramifications; first, it allows some easy extension simply by
8
+ passing a block to the constructor, as such:
9
+
10
+ ```ruby
11
+ a = MyObject.new(an_argument: :foo) { |instance| instance.an_argument = :bar }
12
+ a.an_argument # => :bar
13
+ ```
14
+
15
+ More importantly, it allows for simpler subclassing:
16
+
17
+ ```ruby
18
+ class MyCommand < Skywalker::Command
19
+ def initialize(*args)
20
+ super do
21
+ a_symbol = :new_symbol
22
+ end
23
+ end
24
+ end
25
+ ```
26
+
3
27
  ## 2.0.0 (2015-05-02)
4
28
 
5
29
  - Refactors guts of commands to extract kwarg instantiation pattern into `Acceptable` module.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- skywalker (2.0.0)
4
+ skywalker (2.1.0)
5
5
  activerecord (>= 4.0)
6
6
 
7
7
  GEM
@@ -12,7 +12,8 @@ module Skywalker
12
12
 
13
13
 
14
14
  #
15
- # Instantiates an object, setting all kwargs as accessors.
15
+ # Instantiates an object, setting all kwargs as accessors, and yields self
16
+ # to any block given.
16
17
  #
17
18
  # @since 2.0.0
18
19
  #
@@ -22,6 +23,8 @@ module Skywalker
22
23
 
23
24
  validate_arguments!
24
25
  parse_arguments
26
+
27
+ yield self if block_given?
25
28
  end
26
29
 
27
30
 
@@ -1,3 +1,3 @@
1
1
  module Skywalker
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -39,6 +39,11 @@ module Skywalker
39
39
  allow_any_instance_of(klass).to receive(:required_args).and_return([:required_arg])
40
40
  expect { klass.new(required_arg: :blah) }.not_to raise_error
41
41
  end
42
+
43
+ it "yields self if given a block" do
44
+ instance = klass.new(a_symbol: :my_symbol) { |_self| _self.a_symbol = :new_symbol }
45
+ expect(instance.a_symbol).to eq :new_symbol
46
+ end
42
47
  end
43
48
  end
44
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skywalker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Yurkowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-02 00:00:00.000000000 Z
11
+ date: 2015-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord