humpday 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d91f0cc751ee2997fe4d9b90d4d01a9b440e27a
4
- data.tar.gz: 795ceb4d2b350e99ce723a2bd1fcd7a4fac1aff6
3
+ metadata.gz: 713e4c636e0d5a5ecbc3bd919989c9e4a61aedcc
4
+ data.tar.gz: 30b223624e8b671764020e818a827372c8f2221a
5
5
  SHA512:
6
- metadata.gz: 0740764b7a1b81323f865ec781ed5560cdcf314bba54dacda19bab3d05b041d159832753fa11e7c35ffef27e6c863311ac1f4eeab1c8f6d5c87b952ef5030fee
7
- data.tar.gz: c5b39d238a02739168b6965234dc1796f0281a86041132acc135eec656028bbebdf02a7c71526da1196bd3352e812891ccf74769f7967385dd70e516a1e9967a
6
+ metadata.gz: 2f2e0da9cb44c122b3b0f3859eab2a222f2fae0e6da921eb4e483e3961e39725c860ab04e1c22b4992a0dbb6a5c30bf81ba61c8152075fc4b053f7802aba53bd
7
+ data.tar.gz: 8cbffb0fc86c8f6b7c17fb46cfa4127a5672040303f17140c8350033c2408730caa77bf18d23944f74e94146e89624e06227a8c485cb7e0e37bb2ee7cce276cb
data/README.md CHANGED
@@ -8,7 +8,11 @@ says "humpday"
8
8
 
9
9
  ## Usage
10
10
 
11
- run `humpday` on the commandline
11
+ run `humpday` on the commandline for help
12
+
13
+ ## Changes
14
+
15
+ 1.1.0 - Now with fuzzy matching of the sound name!
12
16
 
13
17
  ## Contributing
14
18
 
data/bin/humpday CHANGED
@@ -9,7 +9,7 @@ elsif ARGV.size == 1 && ARGV[0] != '-h' && ARGV[0] != 'help' && ARGV[0] != '--he
9
9
  begin
10
10
  Humpday.play ARGV[0]
11
11
  rescue Humpday::UnknownSoundError
12
- abort "#{ARGV[0]} is not a known sound"
12
+ abort "#{ARGV[0]} does not match a known sound"
13
13
  end
14
14
  else
15
15
  puts Humpday.usage
@@ -1,3 +1,3 @@
1
1
  module Humpday
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/humpday.rb CHANGED
@@ -7,7 +7,7 @@ module Humpday
7
7
  SOUNDS = {
8
8
  'uhoh' => 'uhoh',
9
9
  'guess_what_day' => 'guess_what_day_it_is',
10
- 'guess_what_day2' => 'guess_what_day_it_is2',
10
+ 'guess_what_day_2'=> 'guess_what_day_it_is2',
11
11
  'huh' => 'huh_anybody',
12
12
  'cmon' => 'aw_cmon_i_know_you_can_hear_me',
13
13
  'laugh' => 'laugh',
@@ -15,7 +15,9 @@ module Humpday
15
15
  'humpday' => 'humpday'
16
16
  }
17
17
 
18
- def self.play sound_name
18
+ def self.play name
19
+ sound_name = self.fuzzy_find name
20
+ raise UnknownSoundError if sound_name.nil?
19
21
  sound = SOUNDS.fetch(sound_name) { raise UnknownSoundError }
20
22
  audio_file = File.expand_path("../../lib/support/#{sound}.m4a", __FILE__)
21
23
  Sounder.play audio_file
@@ -29,11 +31,11 @@ module Humpday
29
31
  [ "humpday version #{Humpday::VERSION}",
30
32
  "Usage: humpday help (this)",
31
33
  "Usage: humpday random (picks a random sound)",
32
- "Usage: humpday <sound name>",
34
+ "Usage: humpday <sound name> (it will fuzzy match the name)",
33
35
  "Sounds:",
34
36
  " uhoh",
35
37
  " guess_what_day",
36
- " guess_what_day2",
38
+ " guess_what_day_2",
37
39
  " huh",
38
40
  " cmon",
39
41
  " laugh",
@@ -41,4 +43,9 @@ module Humpday
41
43
  " humpday"
42
44
  ].join "\n"
43
45
  end
46
+
47
+ private
48
+ def self.fuzzy_find name
49
+ SOUNDS.keys.select { |sn| sn.include? name }.first
50
+ end
44
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humpday
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
  - Adam Zaninovich