r38y-radio 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.textile +14 -15
  2. data/bin/radioize +2 -1
  3. data/lib/radio.rb +20 -0
  4. metadata +3 -2
@@ -1,32 +1,31 @@
1
- = radio
1
+ h1. DESCRIPTION:
2
2
 
3
- * FIX (url)
3
+ Generates a radio alphabet version of a word ie radio => romeo-alpha-delta-india-oscar
4
4
 
5
- == DESCRIPTION:
5
+ http://github.com/r38y/radio
6
6
 
7
- FIX (describe your package)
7
+ h1. FEATURES/PROBLEMS:
8
8
 
9
- == FEATURES/PROBLEMS:
9
+ * None yet?
10
10
 
11
- * FIX (list of features or problems)
11
+ h1. SYNOPSIS:
12
12
 
13
- == SYNOPSIS:
13
+ * In ruby code - Radio.radioize(word, separator)
14
+ * Command-line $ radioize word
14
15
 
15
- FIX (code sample of usage)
16
+ h1. REQUIREMENTS:
16
17
 
17
- == REQUIREMENTS:
18
+ * None
18
19
 
19
- * FIX (list of requirements)
20
+ h1. INSTALL:
20
21
 
21
- == INSTALL:
22
+ * sudo gem install r38y-radio
22
23
 
23
- * FIX (sudo gem install, anything else)
24
-
25
- == LICENSE:
24
+ h1. LICENSE:
26
25
 
27
26
  (The MIT License)
28
27
 
29
- Copyright (c) 2009 FIXME full name
28
+ Copyright (c) 2009 Randy Schmidt
30
29
 
31
30
  Permission is hereby granted, free of charge, to any person obtaining
32
31
  a copy of this software and associated documentation files (the
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
- require 'lib/radio'
3
+ require 'radio'
4
+
4
5
  if ARGV.first
5
6
  puts Radio.radioize(ARGV.first)
6
7
  else
@@ -0,0 +1,20 @@
1
+ require 'radio/string'
2
+
3
+ module Radio
4
+ def self.radioize(word, delimiter='-')
5
+ word.gsub(/\W/, '').split('').map do |i|
6
+ if i.upcase?
7
+ NATO[i.downcase].upcase
8
+ else
9
+ NATO[i]
10
+ end
11
+ end.join(delimiter)
12
+ end
13
+
14
+ NATO = {
15
+ "0"=>"Zero", "1"=>"One", "2"=>"Two", "3"=>"Three", "4"=>"Four", "5"=>"Five", "6"=>"Six", "7"=>"Seven", "8"=>"Eight", "9"=>"Nine",
16
+ "a"=>"alpha", "b"=>"bravo", "c"=>"charlie", "d"=>"delta", "e"=>"echo", "f"=>"foxtrot", "g"=>"golf", "h"=>"hotel", "i"=>"india",
17
+ "j"=>"juliet", "k"=>"kilo", "l"=>"lima", "m"=>"mike", "n"=>"november", "o"=>"oscar", "p"=>"papa", "q"=>"quebec", "r"=>"romeo",
18
+ "s"=>"sierra", "t"=>"tango", "u"=>"uniform", "v"=>"victor", "w"=>"whiskey", "x"=>"xray", "y"=>"yankee", "z"=>"zulu"
19
+ }
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r38y-radio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Randy Schmidt
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-13 00:00:00 -08:00
12
+ date: 2009-02-14 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -45,6 +45,7 @@ files:
45
45
  - Rakefile
46
46
  - README.textile
47
47
  - lib
48
+ - lib/radio.rb
48
49
  - lib/radio
49
50
  - lib/radio/string.rb
50
51
  - script