rfortune 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  == Changelog
2
2
 
3
+ === dev
4
+
5
+ * Added options Hash to 'random_fortune' method
6
+
3
7
  === 0.2.1 (2009-12-12)
4
8
 
5
9
  * Added class method 'random_fortune'. Usable with or without block.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.1
@@ -158,7 +158,9 @@ class RFortune
158
158
  # That means FOREVER! So be careful!
159
159
  # Takes 'false' as an argument if you'd like to include offensive
160
160
  # fortunes.
161
- def self.random_fortune( no_offense = true )
161
+ def self.random_fortune( options = {} )
162
+
163
+ options.class != Hash and raise TypeError, 'Can\'t convert ' + options.class.to_s + ' to Hash'
162
164
 
163
165
  cookie_jars = []
164
166
 
@@ -168,7 +170,7 @@ class RFortune
168
170
 
169
171
  }
170
172
 
171
- unless no_offense
173
+ unless options[:offensive]
172
174
 
173
175
  Dir.foreach( FORTUNES_PATH + 'off/' ) { |filename|
174
176
 
@@ -90,7 +90,7 @@ class RFortuneTest < Test::Unit::TestCase
90
90
  assert_equal String, RFortune.random_fortune.class, 'Try to get a random fortune from fortune\'s fortunes'
91
91
 
92
92
  # Include offensive fortunes
93
- assert_equal String, RFortune.random_fortune( false ).class, 'Try to get a random fortune from fortune\'s fortunes'
93
+ assert_equal String, RFortune.random_fortune( :offensive => true ).class, 'Try to get a random fortune from fortune\'s fortunes'
94
94
 
95
95
  # From block
96
96
  i = 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfortune
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Helge Rausch
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-12 00:00:00 +01:00
12
+ date: 2010-01-12 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15