Class: OpenBD::Contributor
- Inherits:
-
Object
- Object
- OpenBD::Contributor
- Defined in:
- lib/open_bd/contributor.rb
Constant Summary collapse
- ROLE_MAP =
{ "A01" => "著者", "B06" => "翻訳者" }.freeze
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(source) ⇒ Contributor
constructor
A new instance of Contributor.
- #kana_name ⇒ Object
- #name ⇒ Object
- #role ⇒ Object
- #roles ⇒ Object
Constructor Details
#initialize(source) ⇒ Contributor
Returns a new instance of Contributor.
10 11 12 |
# File 'lib/open_bd/contributor.rb', line 10 def initialize(source) @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
3 4 5 |
# File 'lib/open_bd/contributor.rb', line 3 def source @source end |
Instance Method Details
#description ⇒ Object
14 15 16 |
# File 'lib/open_bd/contributor.rb', line 14 def description source.dig("BiographicalNote") end |
#kana_name ⇒ Object
18 19 20 |
# File 'lib/open_bd/contributor.rb', line 18 def kana_name source.dig("PersonName", "collationkey") end |
#name ⇒ Object
22 23 24 |
# File 'lib/open_bd/contributor.rb', line 22 def name source.dig("PersonName", "content") end |
#role ⇒ Object
26 27 28 |
# File 'lib/open_bd/contributor.rb', line 26 def role roles.first end |
#roles ⇒ Object
30 31 32 33 34 |
# File 'lib/open_bd/contributor.rb', line 30 def roles source.dig("ContributorRole").map do |role| ROLE_MAP[role] end end |