require_options 1.0.0 → 1.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.
data/README.rdoc CHANGED
@@ -12,6 +12,10 @@ RequireOptions accomplishes both tasks succinctly.
12
12
 
13
13
  == Install
14
14
  script/plugin git://github.com/atomicobject/require_options.git
15
+
16
+ or
17
+
18
+ gem install require_options
15
19
 
16
20
  == Example
17
21
  class Car
@@ -1,5 +1,7 @@
1
1
  module RequireOptions
2
2
  def require_options(options, *required_keys)
3
+ raise ArgumentError, "options must be a hash" unless options.is_a?(Hash)
4
+
3
5
  values = required_keys.flatten.map do |key|
4
6
  val = options[key]
5
7
  raise "#{key} required" unless options[key]
@@ -30,6 +30,12 @@ describe RequireOptions do
30
30
  require_options(opts, :gear, :speed)
31
31
  }.should raise_error("speed required")
32
32
  end
33
+
34
+ it "raises an error if anything other than a hash is passed in" do
35
+ lambda {
36
+ require_options(2, :pole)
37
+ }.should raise_error(ArgumentError, /options must be a hash/i)
38
+ end
33
39
  end
34
40
 
35
41
  describe "#allow_options" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: require_options
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Atomic Object
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-31 00:00:00 -05:00
12
+ date: 2010-02-03 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,13 +22,11 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - LICENSE
24
24
  - README.rdoc
25
- - TODO
26
25
  files:
27
26
  - LICENSE
28
27
  - Rakefile
29
28
  - lib/require_options.rb
30
29
  - README.rdoc
31
- - TODO
32
30
  has_rdoc: true
33
31
  homepage: http://github.com/atomicobject/require_options
34
32
  licenses: []
data/TODO DELETED
@@ -1 +0,0 @@
1
- * Make gem