blockenspiel 0.3.0-java → 0.3.1-java
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.
- data/History.rdoc +8 -0
- data/Rakefile +0 -2
- data/lib/blockenspiel/impl.rb +16 -8
- data/lib/blockenspiel/version.rb +3 -1
- data/lib/blockenspiel/versionomy.rb +51 -0
- data/lib/blockenspiel_unmixer.jar +0 -0
- data/tests/tc_dynamic.rb +19 -0
- metadata +4 -3
data/History.rdoc
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
=== 0.3.1 / 2009-11-08
|
|
2
|
+
|
|
3
|
+
* Blockenspiel#invoke can now take its options hash as the second argument
|
|
4
|
+
(instead of the third) when using dynamic target generation, since the
|
|
5
|
+
second argument is otherwise unused in this case.
|
|
6
|
+
* Now defines Blockenspiel::VERSION, as a versionomy object if the
|
|
7
|
+
versionomy library is available, or as a version string if not.
|
|
8
|
+
|
|
1
9
|
=== 0.3.0 / 2009-11-04
|
|
2
10
|
|
|
3
11
|
* dsl_attr_writer and dsl_attr_accessor convenience methods are available
|
data/Rakefile
CHANGED
data/lib/blockenspiel/impl.rb
CHANGED
|
@@ -655,6 +655,10 @@ module Blockenspiel
|
|
|
655
655
|
#
|
|
656
656
|
# See the Blockenspiel::Builder class for more details on add_method.
|
|
657
657
|
#
|
|
658
|
+
# When using dynamic target generation, you may pass the options hash as
|
|
659
|
+
# the second argument to invoke instead of the third, since you will not
|
|
660
|
+
# be passing a target object as the second argument.
|
|
661
|
+
#
|
|
658
662
|
# (And yes, you guessed it: this API is a DSL block, and is itself
|
|
659
663
|
# implemented using Blockenspiel.)
|
|
660
664
|
|
|
@@ -663,6 +667,18 @@ module Blockenspiel
|
|
|
663
667
|
unless block_
|
|
664
668
|
raise ::ArgumentError, "Block expected"
|
|
665
669
|
end
|
|
670
|
+
|
|
671
|
+
# Perform dynamic target generation if requested
|
|
672
|
+
if builder_block_
|
|
673
|
+
# Support passing the opts hash as the second argument since we
|
|
674
|
+
# aren't passing a target as an argument.
|
|
675
|
+
opts_ = target_ || opts_
|
|
676
|
+
builder_ = ::Blockenspiel::Builder.new
|
|
677
|
+
invoke(builder_block_, builder_)
|
|
678
|
+
target_ = builder_._create_target
|
|
679
|
+
end
|
|
680
|
+
|
|
681
|
+
# Read options
|
|
666
682
|
parameter_ = opts_[:parameter]
|
|
667
683
|
parameterless_ = opts_[:parameterless]
|
|
668
684
|
|
|
@@ -674,14 +690,6 @@ module Blockenspiel
|
|
|
674
690
|
return block_.call
|
|
675
691
|
end
|
|
676
692
|
|
|
677
|
-
# Perform dynamic target generation if requested
|
|
678
|
-
if builder_block_
|
|
679
|
-
opts_ = target_ || opts_
|
|
680
|
-
builder_ = ::Blockenspiel::Builder.new
|
|
681
|
-
invoke(builder_block_, builder_)
|
|
682
|
-
target_ = builder_._create_target
|
|
683
|
-
end
|
|
684
|
-
|
|
685
693
|
# Handle parametered block case
|
|
686
694
|
if parameter_ != false && block_.arity == 1 || parameterless_ == false
|
|
687
695
|
if block_.arity != 1
|
data/lib/blockenspiel/version.rb
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
#
|
|
3
|
+
# Blockenspiel version
|
|
4
|
+
#
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
# Copyright 2008-2009 Daniel Azuma
|
|
7
|
+
#
|
|
8
|
+
# All rights reserved.
|
|
9
|
+
#
|
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
|
12
|
+
#
|
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
|
14
|
+
# this list of conditions and the following disclaimer.
|
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
|
17
|
+
# and/or other materials provided with the distribution.
|
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
|
20
|
+
# derived from this software without specific prior written permission.
|
|
21
|
+
#
|
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
# -----------------------------------------------------------------------------
|
|
34
|
+
;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
begin
|
|
38
|
+
require 'versionomy'
|
|
39
|
+
rescue ::LoadError
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
module Blockenspiel
|
|
44
|
+
|
|
45
|
+
unless const_defined?(:VERSION)
|
|
46
|
+
# Current gem version, as a Versionomy::Value if the versionomy library
|
|
47
|
+
# is available, or as a frozen string if not.
|
|
48
|
+
VERSION = defined?(::Versionomy) ? ::Versionomy.parse(VERSION_STRING, :standard) : VERSION_STRING
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
Binary file
|
data/tests/tc_dynamic.rb
CHANGED
|
@@ -197,6 +197,25 @@ end
|
|
|
197
197
|
end
|
|
198
198
|
|
|
199
199
|
|
|
200
|
+
# Test passing options in.
|
|
201
|
+
#
|
|
202
|
+
# * Asserts that the "parameter" option is recognized
|
|
203
|
+
|
|
204
|
+
def test_options_recognized
|
|
205
|
+
block_ = ::Proc.new do
|
|
206
|
+
set_value(:a, 1)
|
|
207
|
+
end
|
|
208
|
+
hash_ = ::Hash.new
|
|
209
|
+
assert_raise(::Blockenspiel::BlockParameterError) do
|
|
210
|
+
::Blockenspiel.invoke(block_, :parameterless => false) do
|
|
211
|
+
add_method(:set_value) do |key_, value_|
|
|
212
|
+
hash_[key_] = value_
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
|
|
200
219
|
end
|
|
201
220
|
|
|
202
221
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blockenspiel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Azuma
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-11-
|
|
12
|
+
date: 2009-11-08 00:00:00 -08:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
@@ -31,7 +31,7 @@ files:
|
|
|
31
31
|
- lib/blockenspiel.rb
|
|
32
32
|
- lib/blockenspiel/impl.rb
|
|
33
33
|
- lib/blockenspiel/version.rb
|
|
34
|
-
- lib/
|
|
34
|
+
- lib/blockenspiel/versionomy.rb
|
|
35
35
|
- tests/tc_basic.rb
|
|
36
36
|
- tests/tc_behaviors.rb
|
|
37
37
|
- tests/tc_dsl_attrs.rb
|
|
@@ -43,6 +43,7 @@ files:
|
|
|
43
43
|
- ImplementingDSLblocks.rdoc
|
|
44
44
|
- README.rdoc
|
|
45
45
|
- Rakefile
|
|
46
|
+
- lib/blockenspiel_unmixer.jar
|
|
46
47
|
has_rdoc: true
|
|
47
48
|
homepage: http://virtuoso.rubyforge.org/blockenspiel
|
|
48
49
|
licenses: []
|