Class: ModsDisplay::Name::Person
- Inherits:
-
Object
- Object
- ModsDisplay::Name::Person
- Defined in:
- lib/mods_display/fields/name.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#role ⇒ Object
Returns the value of attribute role.
Instance Method Summary collapse
-
#initialize(data) ⇒ Person
constructor
A new instance of Person.
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ Person
Returns a new instance of Person.
76 77 78 79 |
# File 'lib/mods_display/fields/name.rb', line 76 def initialize(data) @name = data[:name] @role = data[:role] ? data[:role].text : nil end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
75 76 77 |
# File 'lib/mods_display/fields/name.rb', line 75 def name @name end |
#role ⇒ Object
Returns the value of attribute role.
75 76 77 |
# File 'lib/mods_display/fields/name.rb', line 75 def role @role end |
Instance Method Details
#to_s ⇒ Object
81 82 83 84 85 |
# File 'lib/mods_display/fields/name.rb', line 81 def to_s text = @name.dup text << " (#{@role})" if @role text end |