to_insane 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -33,8 +33,8 @@ Paypal address: mailto:dougal.s@gmail.com
33
33
  4507467.to_insane(50) # => 'A2Ph'
34
34
 
35
35
  # Different Character Sets
36
- 'A2Ph'.from_insane(4,'A2Ph') # => 27
37
- 27.to_insane(4,'A2Ph')
36
+ 'A2Ph'.from_insane(:max,'A2Ph') # => 27
37
+ 27.to_insane(:max,'A2Ph')
38
38
 
39
39
  # Other Inputs
40
40
  # :url_safe uses the max number characters that are RFC URL non reserved
@@ -50,6 +50,7 @@ Default Character set. I choose not to use any slashes or quotes of any sort to
50
50
  == Credits
51
51
 
52
52
  Ryan Ong - http://ryangong.net
53
+
53
54
  Douglas F Shearer - http://douglasfshearer.com
54
55
 
55
- Test examples courtesy Fraser Speirs' Base58Encoder Objective-C class, http://gist.github.com/101674.
56
+ Developed for and with CarZen.com
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/lib/to_insane.rb CHANGED
@@ -6,7 +6,9 @@ INSANECHARACTERS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ
6
6
 
7
7
  class String
8
8
  # Converts a string to a base x integer using y character set.
9
- def from_insane(base_val = 58, alpha = INSANECHARACTERS)
9
+ def from_insane(base_val = nil, alpha = nil)
10
+ base_val ||= 58
11
+ alpha ||= INSANECHARACTERS
10
12
  base_val = alpha.size if base_val == :max
11
13
  if base_val == :url_safe
12
14
  base_val = 63
@@ -28,7 +30,9 @@ end
28
30
 
29
31
  class Integer
30
32
  # Converts a base10 integer to a base x string.
31
- def to_insane(base_val = 58, alpha = INSANECHARACTERS)
33
+ def to_insane(base_val = nil, alpha = nil)
34
+ alpha ||= INSANECHARACTERS
35
+ base_val ||= 58
32
36
  base_val = alpha.size if base_val == :max
33
37
  if base_val == :url_safe
34
38
  base_val = 63
data/to_insane.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{to_insane}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Ong"]
12
- s.date = %q{2011-02-08}
12
+ s.date = %q{2011-02-16}
13
13
  s.description = %q{ToInsane allows you to convert strings and integers to a Base larger than the default max of 36 and use a custom character set}
14
14
  s.email = %q{ryanong@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: to_insane
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan Ong
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-08 00:00:00 -05:00
13
+ date: 2011-02-16 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies: []
16
16