Class: Scripref::Bookname

Inherits:
Object
  • Object
show all
Defined in:
lib/scripref/bookname.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#abbrevsObject (readonly)

Returns the value of attribute abbrevs.



8
9
10
# File 'lib/scripref/bookname.rb', line 8

def abbrevs
  @abbrevs
end

#namesObject (readonly)

Returns the value of attribute names.



8
9
10
# File 'lib/scripref/bookname.rb', line 8

def names
  @names
end

#osis_idObject (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

#nameObject



16
17
18
# File 'lib/scripref/bookname.rb', line 16

def name
  @names.first
end

#to_sObject Also known as: to_str



24
25
26
# File 'lib/scripref/bookname.rb', line 24

def to_s
  @osis_id.to_s
end