Class: Theoj::Orcid
- Inherits:
-
Object
- Object
- Theoj::Orcid
- Defined in:
- lib/theoj/orcid.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#orcid ⇒ Object
readonly
Returns the value of attribute orcid.
Instance Method Summary collapse
-
#initialize(orcid) ⇒ Orcid
constructor
A new instance of Orcid.
- #packed_orcid ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(orcid) ⇒ Orcid
Returns a new instance of Orcid.
5 6 7 8 |
# File 'lib/theoj/orcid.rb', line 5 def initialize(orcid) @orcid = orcid.strip @error = nil end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
3 4 5 |
# File 'lib/theoj/orcid.rb', line 3 def error @error end |
#orcid ⇒ Object (readonly)
Returns the value of attribute orcid.
3 4 5 |
# File 'lib/theoj/orcid.rb', line 3 def orcid @orcid end |
Instance Method Details
#packed_orcid ⇒ Object
21 22 23 |
# File 'lib/theoj/orcid.rb', line 21 def packed_orcid orcid.gsub('-', '') end |
#valid? ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/theoj/orcid.rb', line 10 def valid? @error = nil return false unless check_structure return false unless check_length return false unless check_chars return false unless correct_checksum? true end |