short-url-creator 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/short-url-creator.rb +7 -2
  2. metadata +1 -1
@@ -15,6 +15,7 @@ class ShortUrlCreator
15
15
  @count = 0
16
16
  @a = Array.new(7, -1)
17
17
  @k = 0
18
+ @short_url = []
18
19
  end
19
20
 
20
21
  def iterate_chars(array_size)
@@ -33,13 +34,17 @@ class ShortUrlCreator
33
34
  k = a.length
34
35
  if (k > 1)
35
36
  if ((@h[a[k-2]] + @h[a[k-1]]) != '10')
36
- puts buffer.reverse
37
+ @short_url << buffer.reverse
37
38
  end
38
39
  else
39
- puts buffer.reverse
40
+ @short_url << buffer.reverse
40
41
  end
41
42
  end
42
43
 
44
+ def generate(count)
45
+ get_short_url(count)
46
+ @short_url.join
47
+ end
43
48
  def get_short_url(count)
44
49
  if count > @array_size
45
50
  new_count = count - @array_size
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: short-url-creator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors: []
7
7