astrological-number 0.0.1 → 0.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: 03b96673fb47d333f6c4ef8b8fe2635868043304
4
- data.tar.gz: 6339f70b8ba3eb60d5f85eb621f7c8eaba8947e4
3
+ metadata.gz: ff837a3aa3741cb41f045816f7732e8e5f12d470
4
+ data.tar.gz: 76c31816bd5760a1a8bbf2c45c9f656a278df5a7
5
5
  SHA512:
6
- metadata.gz: 93f97899e200fd9f4fe1570eea6f4afe73731fdecab3826306887caba79aceefa0678a4ed4628b9e4f607537b03fd961a899d2d30457060f0c4aac65d8d47d69
7
- data.tar.gz: f738b75b3616cdce181bbd5c43b9be7d77697a5dbfb97129f7b8b1650ab570ac144402dd4eb90690caf22f4d918738a3310f1d7a1dbd51d9ff81c0e310b14f5d
6
+ metadata.gz: f200b11ff4e066cdf81b093e0e4cfb1462e7472fadc5d7852ebecbf601b94ecd02920acf62d27d2c9f47f945719cb57accfc8da5f977e74f614c22441532d402
7
+ data.tar.gz: 743a7a1471ced2646dda4df1ff14a8ab7fe8bba32ac69a6f8532f28b4b18835b6084c991ad6dce2a20b776c4de13f9476f6dba75c6f35201e72ed23a2d32ea92
@@ -0,0 +1,24 @@
1
+
2
+
3
+ The MIT License (MIT)
4
+
5
+ Copyright (c) 2016 Astrological Number
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+
@@ -0,0 +1,36 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalization:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "https://rubygems.org"
2
+ gemspec
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ astrological-number (0.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.2.5)
10
+ rspec (3.4.0)
11
+ rspec-core (~> 3.4.0)
12
+ rspec-expectations (~> 3.4.0)
13
+ rspec-mocks (~> 3.4.0)
14
+ rspec-core (3.4.1)
15
+ rspec-support (~> 3.4.0)
16
+ rspec-expectations (3.4.0)
17
+ diff-lcs (>= 1.2.0, < 2.0)
18
+ rspec-support (~> 3.4.0)
19
+ rspec-mocks (3.4.1)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.4.0)
22
+ rspec-support (3.4.1)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ astrological-number!
29
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Punit Jain
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ # astrological_number
2
+ Astrological number gem get the number from date of birth
@@ -0,0 +1,28 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "astrological-number"
3
+ s.version = "0.1.0"
4
+ s.default_executable = "astrological-number"
5
+
6
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
+ s.authors = ["Punit Jain"]
8
+ s.date = %q{2016-01-18}
9
+ s.description = %q{Get the astrological number from date of birth}
10
+ s.email = %q{jainpunit786@gmail.com}
11
+ s.license = 'MIT'
12
+ s.files = `git ls-files`.split("\n")
13
+ s.homepage = %q{https://github.com/punitcse/astrological_number}
14
+ s.require_paths = ["lib"]
15
+ s.rubygems_version = %q{1.6.2}
16
+ s.summary = %q{astrological number}
17
+ s.add_development_dependency 'rspec', '~> 0'
18
+
19
+ if s.respond_to? :specification_version then
20
+ s.specification_version = 3
21
+
22
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
23
+ else
24
+ end
25
+ else
26
+ end
27
+ end
28
+
@@ -1,27 +1,30 @@
1
1
  class AstrologicalNumber
2
2
  attr_accessor :date_of_birth, :day, :month, :year
3
3
 
4
+ def initialize(dob)
5
+ @date_of_birth = dob
6
+ @day, @month, @year = dob.split('-')
7
+ end
8
+
4
9
  def self.get_number
5
10
  p "Please enter your date_of_birth in dd-mm-yyyy format"
6
- AstrologicalNumber.new(gets)
11
+ AstrologicalNumber.new(gets).check_validation
7
12
  end
8
13
 
9
- def initialize(dob)
10
- @date_of_birth = dob
14
+ def calculate_number
15
+ dob = [day, month, year].join.to_i
16
+ total(dob)
17
+ end
18
+
19
+ def check_validation
11
20
  if valid?
12
- @day, @month, @year = dob.split('-')
13
21
  p "Your Lucky Number is #{calculate_number}"
14
22
  else
15
- p "Please enter date_of_birth in correct format (dd-mm-yyyy) "
16
- AstrologicalNumber.new(gets)
23
+ p "Invalid format"
24
+ AstrologicalNumber.get_number
17
25
  end
18
26
  end
19
27
 
20
- def calculate_number
21
- dob = [day, month, year].join.to_i
22
- total(dob)
23
- end
24
-
25
28
  private
26
29
 
27
30
  def valid?
@@ -35,7 +38,6 @@ private
35
38
  d = d/10
36
39
  sum += rem
37
40
  end
38
- sum < 10 ? sum : total(sum)
41
+ p (sum < 10 ? sum : total(sum))
39
42
  end
40
43
  end
41
-
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+ describe AstrologicalNumber do
3
+ context 'With valid date' do
4
+ let(:dob) { AstrologicalNumber.new('03-10-1989') }
5
+
6
+ it { expect(dob.send(:valid?)).to be_truthy }
7
+ it 'should give correct astrological number' do
8
+ expect(dob.calculate_number).to eq(4)
9
+ end
10
+ end
11
+
12
+ context 'With Invalid date' do
13
+ let(:dob) { AstrologicalNumber.new('0319-1989') }
14
+
15
+ it { expect(dob.send(:valid?)).to be_falsy }
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+ Bundler.setup
3
+
4
+ require 'astrological_number'
5
+
6
+ RSpec.configure do |config|
7
+
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astrological-number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Punit Jain
@@ -9,15 +9,39 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-01-18 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Get the astrological number from date of birth
14
28
  email: jainpunit786@gmail.com
15
29
  executables: []
16
30
  extensions: []
17
31
  extra_rdoc_files: []
18
32
  files:
33
+ - " LICENSE.txt"
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - Gemfile.lock
37
+ - LICENSE
38
+ - README.md
39
+ - astrological-number-0.0.1.gem
40
+ - astrological_number.gemspec
19
41
  - lib/astrological_number.rb
20
- homepage: http://rubygems.org/gems/astrological-number
42
+ - spec/astrological_number_spec.rb
43
+ - spec/spec_helper.rb
44
+ homepage: https://github.com/punitcse/astrological_number
21
45
  licenses:
22
46
  - MIT
23
47
  metadata: {}