Class: RMARC::Subfield
- Inherits:
-
Object
- Object
- RMARC::Subfield
- Defined in:
- lib/rmarc/model/subfield.rb
Overview
This class represents a subfield in a MARC record.
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(code, data = nil) ⇒ Subfield
constructor
Default constructor.
-
#to_s ⇒ Object
Returns a string representation for a subfield.
Constructor Details
#initialize(code, data = nil) ⇒ Subfield
Default constructor
31 32 33 34 |
# File 'lib/rmarc/model/subfield.rb', line 31 def initialize(code, data = nil) @code = code @data = data end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
28 29 30 |
# File 'lib/rmarc/model/subfield.rb', line 28 def code @code end |
#data ⇒ Object
Returns the value of attribute data.
28 29 30 |
# File 'lib/rmarc/model/subfield.rb', line 28 def data @data end |
Instance Method Details
#to_s ⇒ Object
Returns a string representation for a subfield.
Example:
$aChabon, Michael.
41 42 43 |
# File 'lib/rmarc/model/subfield.rb', line 41 def to_s "$#@code#@data" end |