instrument 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/lib/instrument/control.rb +9 -1
- data/lib/instrument/version.rb +1 -1
- data/spec/instrument/control_spec.rb +13 -1
- data/website/index.html +5 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
data/lib/instrument/control.rb
CHANGED
@@ -134,9 +134,11 @@ module Instrument
|
|
134
134
|
# Creates a new Control object. Subclasses should not override this.
|
135
135
|
#
|
136
136
|
# @param [Hash] options a set of options required by the control
|
137
|
+
# @yield optionally accepts a block used by the control
|
137
138
|
# @return [Instrument::Control] the instanitated control
|
138
|
-
def initialize(options={})
|
139
|
+
def initialize(options={}, &block)
|
139
140
|
@options = options
|
141
|
+
@block = block
|
140
142
|
end
|
141
143
|
|
142
144
|
##
|
@@ -145,6 +147,12 @@ module Instrument
|
|
145
147
|
# @return [Hash] a set of options required by the control
|
146
148
|
attr_reader :options
|
147
149
|
|
150
|
+
##
|
151
|
+
# Returns the block that was supplied when the Control was created.
|
152
|
+
#
|
153
|
+
# @return [Proc] the block used to create the Control
|
154
|
+
attr_reader :block
|
155
|
+
|
148
156
|
##
|
149
157
|
# Returns the Control's name. By default, this is the control's class
|
150
158
|
# name, tranformed into This method may be overridden by a Control.
|
data/lib/instrument/version.rb
CHANGED
@@ -58,6 +58,18 @@ describe Instrument::Control do
|
|
58
58
|
it "should initialize subclasses via method_missing" do
|
59
59
|
Instrument::Control.new.select_control.class.should == SelectControl
|
60
60
|
end
|
61
|
+
|
62
|
+
it "should return the same options used during instantiation" do
|
63
|
+
options = {}
|
64
|
+
control = Instrument::Control.new(options)
|
65
|
+
control.options.should eql(options)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should return the same proc used during instantiation" do
|
69
|
+
proc = lambda {}
|
70
|
+
control = Instrument::Control.new(&proc)
|
71
|
+
control.block.should eql(proc)
|
72
|
+
end
|
61
73
|
|
62
74
|
it "should still raise an Exception for non-existent methods" do
|
63
75
|
(lambda do
|
@@ -77,7 +89,7 @@ describe Instrument::Control do
|
|
77
89
|
end).should raise_error(Instrument::ResourceNotFoundError)
|
78
90
|
end
|
79
91
|
|
80
|
-
it "should raise an Exception if a
|
92
|
+
it "should raise an Exception if a template engine is missing" do
|
81
93
|
(lambda do
|
82
94
|
SelectControl.new.to_txt
|
83
95
|
end).should raise_error(Instrument::InvalidTemplateEngineError)
|
data/website/index.html
CHANGED
@@ -76,6 +76,11 @@
|
|
76
76
|
Project Page
|
77
77
|
</a>
|
78
78
|
</li>
|
79
|
+
<li>
|
80
|
+
<a href="http://github.com/sporkmonger/instrument/tree/">
|
81
|
+
GitHub Page
|
82
|
+
</a>
|
83
|
+
</li>
|
79
84
|
<li><a href="/api/">API</a></li>
|
80
85
|
<li><a href="/specdoc/">Specifications</a></li>
|
81
86
|
<li><a href="/coverage/">Code Coverage</a></li>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instrument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Aman
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-05-
|
12
|
+
date: 2008-05-27 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|