duboff-primer 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 320e7eaf32ffdaa9b63dae4e286ec570cc14eab3
4
- data.tar.gz: 138380c35c290865a112b8e65e3690f1c196eb3d
3
+ metadata.gz: 11ccea9ad027e5b9abca16b432d6edc68b92fe5e
4
+ data.tar.gz: e7bdff6dec8cbb8a0f08fe50edeec7c959af3d9f
5
5
  SHA512:
6
- metadata.gz: 841dac869752c18e7a4aaa898ac4e948950a53ea15e44c4cb009bb3a6b3e7a2a5f46348d949a807e5bf62001538560a9434f8252d8ddb9af540726baffabf521
7
- data.tar.gz: c7b748dc876c49593b8b53eea6193ab5b2c95f697e5985a1cf137d84fe9e30cc5529582534335f831c30f44b5a5d728db7ff2aecd9ea1581b568829c58551f25
6
+ metadata.gz: 1b635973133cfa7de3874e5d584501de2ba2655c94dbb2109227fdecf14a5ab42b9e3a1ab0f0b197dd87e8356bcb223d68cb18e065a6d08cd573baf3cf4387f8
7
+ data.tar.gz: 96d5aa3214187fd0aff03e5585852c810d1bea0935c10f6915f1a2742b6a1ed6ab8b067d4d1737b0ca0f10941606e735101623ddc3da184ecf2c6daf00a21b63
data/README.md CHANGED
@@ -1,31 +1,27 @@
1
1
  # Primer
2
2
 
3
- TODO: Write a gem description
3
+ This is a simple gem that prints out a multiplication table for first N prime numbers.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'primer'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install primer
7
+ $ gem install duboff-primer
20
8
 
21
9
  ## Usage
22
10
 
23
- TODO: Write usage instructions here
24
-
25
- ## Contributing
11
+ ```
12
+ $ primer print 10
13
+
14
+ | 2 3 5 7 11 13 17 19 23 29
15
+ --- | --- --- --- --- --- --- --- --- --- ---
16
+ 2 | 4 6 10 14 22 26 34 38 46 58
17
+ 3 | 6 9 15 21 33 39 51 57 69 87
18
+ 5 | 10 15 25 35 55 65 85 95 115 145
19
+ 7 | 14 21 35 49 77 91 119 133 161 203
20
+ 11 | 22 33 55 77 121 143 187 209 253 319
21
+ 13 | 26 39 65 91 143 169 221 247 299 377
22
+ 17 | 34 51 85 119 187 221 289 323 391 493
23
+ 19 | 38 57 95 133 209 247 323 361 437 551
24
+ 23 | 46 69 115 161 253 299 391 437 529 667
25
+ 29 | 58 87 145 203 319 377 493 551 667 841
26
+ ```
26
27
 
27
- 1. Fork it ( https://github.com/[my-github-username]/primer/fork )
28
- 2. Create your feature branch (`git checkout -b my-new-feature`)
29
- 3. Commit your changes (`git commit -am 'Add some feature'`)
30
- 4. Push to the branch (`git push origin my-new-feature`)
31
- 5. Create a new Pull Request
Binary file
@@ -31,4 +31,3 @@ module Primer
31
31
  end
32
32
  end
33
33
  end
34
-
data/lib/primer/table.rb CHANGED
@@ -25,21 +25,29 @@ module Primer
25
25
  end
26
26
 
27
27
  def separator
28
- Array.new(array.size, '---')
28
+ Array.new(array.size, '-' * max_string_size)
29
29
  end
30
30
 
31
31
  def columns
32
- [' ', '---'] + formatted_array
32
+ [' ' * max_string_size, '-' * max_string_size] + formatted_array
33
33
  end
34
34
 
35
35
  def formatted_array
36
- array.map { |num| "#{'%3d' % num}" }
36
+ array.map { |num| "#{format % num}" }
37
37
  end
38
38
 
39
39
  def formatted_multiplications
40
40
  multiplications.map do |row|
41
- row.map { |num| "#{'%3d' % num}" }
41
+ row.map { |num| "#{format % num}" }
42
42
  end
43
43
  end
44
+
45
+ def format
46
+ "%#{max_string_size}d"
47
+ end
48
+
49
+ def max_string_size
50
+ (array.max**2).to_s.size
51
+ end
44
52
  end
45
53
  end
@@ -1,3 +1,3 @@
1
1
  module Primer
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/primer-0.0.1.gem ADDED
Binary file
data/primer.gemspec CHANGED
@@ -22,7 +22,4 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_development_dependency "thor"
25
- spec.add_development_dependency "pry"
26
- spec.add_development_dependency "pry-remote"
27
- spec.add_development_dependency "pry-byebug"
28
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duboff-primer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Dubov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,48 +66,6 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: pry-remote
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: pry-byebug
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
69
  description: Generates a multiplication table for the first n primes
112
70
  email:
113
71
  - mdubov@gmail.com
@@ -122,10 +80,12 @@ files:
122
80
  - README.md
123
81
  - Rakefile
124
82
  - bin/primer
83
+ - duboff-primer-0.0.1.gem
125
84
  - lib/primer.rb
126
85
  - lib/primer/generator.rb
127
86
  - lib/primer/table.rb
128
87
  - lib/primer/version.rb
88
+ - primer-0.0.1.gem
129
89
  - primer.gemspec
130
90
  - spec/generator_spec.rb
131
91
  - spec/spec_helper.rb