iceland 0.1.2 → 0.1.3

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: ef1b9601286ec63ae41cbfad801d93ff3c0e7b91
4
- data.tar.gz: aaa43941a8b95be9e661d8e804b3d5dcbbb72c30
3
+ metadata.gz: 95b30f1477b431842ba1b7aec7b3c6be294c6292
4
+ data.tar.gz: 60ef980798f7a838bf414d71515102afa83c2f0a
5
5
  SHA512:
6
- metadata.gz: bf7ae37611866995e018ec7d179819c107d039aecb31485c82b5e653de94698a1aff5b246c71b1ddf75fd8462090147e9ce1db8fce44a8e2dd379f13b70a3943
7
- data.tar.gz: 21de710a07509af70d0766ef80588598daf4a8e8f1028db5cb6c3577959f6d99b0da56a3f8a2d9d04040b2955a90e7f8b2141a3f366be2e01c1b89ecf7404a41
6
+ metadata.gz: 7124e9c2324f5d529664e6aac438d2d850a45cee3a0bf683b51b001e499ef9dfb4cf352939c0b683fb5865853564a15896fb833e1d06e091586249d2b443a184
7
+ data.tar.gz: 31dc4830e351222cc4ad901cddbc9f82d5628fe4bff5250e1ef5d003961d2e50a130fa6d6ea909069fff8bd8c20b40ae37a10b66e962b73931873b7bc8c80917
data/README.md CHANGED
@@ -69,15 +69,22 @@ f = Kennitala.new('010130-2979')
69
69
  k.to_s
70
70
  # => "0101302989"
71
71
 
72
- # Get the entity type (results in 'person' or 'entity')
72
+ # Get the entity type (results in 'person' or 'company')
73
73
  k.entity_type
74
74
  # => "person"
75
75
 
76
+ # It's also possible to use .is_company and .is_person to achieve the same thing
77
+ k.is_company?
78
+ # => false
79
+
80
+ k.is_person?
81
+ # => true
82
+
76
83
  # Get the birth date or registration day as a Date object
77
84
  k.to_date
78
85
  # => #<Date: 1930-01-01 ((2425978j,0s,0n),+0s,2299161j)>
79
86
 
80
- # Get the current age of entity. Useful for age restrictions.
87
+ # Get the current age of the entity. Useful for age restrictions.
81
88
  k.age
82
89
  # => 86
83
90
  ```
@@ -103,6 +110,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
103
110
 
104
111
  Bug reports and pull requests are welcome on GitHub at https://github.com/stefanvignir/iceland_gem.
105
112
 
113
+ Do make sure that the `rspec` unit tests run before sending a pull request and write tests for any new functionality you add.
114
+
106
115
  ## License
107
116
 
108
117
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -1,3 +1,3 @@
1
1
  module Iceland
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
data/lib/iceland.rb CHANGED
@@ -62,6 +62,25 @@ class Kennitala
62
62
  date_integer = @value[0, 2].to_i
63
63
  return 'person' if date_integer < 32
64
64
  return 'company' if (date_integer > 40) && (date_integer < 71)
65
+ false
66
+ end
67
+
68
+ # Check if the entity is a company
69
+ #
70
+ # @return [Boolean]
71
+ def company?
72
+ date_integer = @value[0, 2].to_i
73
+ return true if (date_integer > 40) && (date_integer < 71)
74
+ false
75
+ end
76
+
77
+ # Check if the entity is a person
78
+ #
79
+ # @return [Type] description of returned object
80
+ def person?
81
+ date_integer = @value[0, 2].to_i
82
+ return true if date_integer < 32
83
+ false
65
84
  end
66
85
 
67
86
  # Get the year of birth or registration
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iceland
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Vignir