Class: Marcxella::ControlField
- Inherits:
-
Object
- Object
- Marcxella::ControlField
- Defined in:
- lib/marcxella/controlfield.rb
Overview
A control field (00X). Control fields have a value but no subfields
Instance Attribute Summary collapse
-
#For ⇒ Array
readonly
compatability.
- #subfields ⇒ Object readonly
-
#tag ⇒ String
readonly
the field tag.
-
#value ⇒ String
readonly
the field value.
Instance Method Summary collapse
-
#initialize(node) ⇒ ControlField
constructor
A new instance of ControlField.
-
#subfield(code) ⇒ Object
For compatability.
-
#to_s ⇒ String
a string representation of the field.
Constructor Details
#initialize(node) ⇒ ControlField
Returns a new instance of ControlField.
13 14 15 16 17 |
# File 'lib/marcxella/controlfield.rb', line 13 def initialize(node) @tag = node['tag'] @value = node.text @subfields = [] end |
Instance Attribute Details
#For ⇒ Array (readonly)
compatability. Always an empty array
11 12 13 |
# File 'lib/marcxella/controlfield.rb', line 11 def For @For end |
#subfields ⇒ Object (readonly)
12 13 14 |
# File 'lib/marcxella/controlfield.rb', line 12 def subfields @subfields end |
#tag ⇒ String (readonly)
the field tag
11 12 13 |
# File 'lib/marcxella/controlfield.rb', line 11 def tag @tag end |
#value ⇒ String (readonly)
the field value
11 12 13 |
# File 'lib/marcxella/controlfield.rb', line 11 def value @value end |
Instance Method Details
#subfield(code) ⇒ Object
For compatability. Always returns an empty array because control fields don’t have subfields
28 29 30 |
# File 'lib/marcxella/controlfield.rb', line 28 def subfield(code) @subfields end |
#to_s ⇒ String
a string representation of the field.
21 22 23 |
# File 'lib/marcxella/controlfield.rb', line 21 def to_s "%s %s" % [@tag, @value] end |