Class: Scripref::Bookname
- Inherits:
-
Object
- Object
- Scripref::Bookname
- Defined in:
- lib/scripref/bookname.rb
Instance Attribute Summary collapse
-
#abbrevs ⇒ Object
readonly
Returns the value of attribute abbrevs.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
-
#osis_id ⇒ Object
readonly
Returns the value of attribute osis_id.
Instance Method Summary collapse
- #abbrev(level = 0) ⇒ Object
-
#initialize(osis_id:, names:, abbrevs:) ⇒ Bookname
constructor
A new instance of Bookname.
- #name ⇒ Object
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(osis_id:, names:, abbrevs:) ⇒ Bookname
Returns a new instance of Bookname.
10 11 12 13 14 |
# File 'lib/scripref/bookname.rb', line 10 def initialize osis_id:, names:, abbrevs: @osis_id = osis_id @names = Array(names) @abbrevs = Array(abbrevs) end |
Instance Attribute Details
#abbrevs ⇒ Object (readonly)
Returns the value of attribute abbrevs.
8 9 10 |
# File 'lib/scripref/bookname.rb', line 8 def abbrevs @abbrevs end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
8 9 10 |
# File 'lib/scripref/bookname.rb', line 8 def names @names end |
#osis_id ⇒ Object (readonly)
Returns the value of attribute osis_id.
8 9 10 |
# File 'lib/scripref/bookname.rb', line 8 def osis_id @osis_id end |
Instance Method Details
#abbrev(level = 0) ⇒ Object
20 21 22 |
# File 'lib/scripref/bookname.rb', line 20 def abbrev level=0 @abbrevs[level] || @abbrevs[-1] end |
#name ⇒ Object
16 17 18 |
# File 'lib/scripref/bookname.rb', line 16 def name @names.first end |
#to_s ⇒ Object Also known as: to_str
24 25 26 |
# File 'lib/scripref/bookname.rb', line 24 def to_s @osis_id.to_s end |