Class: Marcxella::DataField
- Inherits:
-
Object
- Object
- Marcxella::DataField
- Defined in:
- lib/marcxella/datafield.rb
Instance Attribute Summary collapse
-
#ind1 ⇒ Object
readonly
Returns the value of attribute ind1.
-
#ind2 ⇒ Object
readonly
Returns the value of attribute ind2.
-
#subfields ⇒ Object
readonly
Returns the value of attribute subfields.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #ind_to_s(i) ⇒ Object
-
#initialize(node) ⇒ DataField
constructor
A new instance of DataField.
- #subfield(code) ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
Constructor Details
Instance Attribute Details
#ind1 ⇒ Object (readonly)
Returns the value of attribute ind1.
3 4 5 |
# File 'lib/marcxella/datafield.rb', line 3 def ind1 @ind1 end |
#ind2 ⇒ Object (readonly)
Returns the value of attribute ind2.
3 4 5 |
# File 'lib/marcxella/datafield.rb', line 3 def ind2 @ind2 end |
#subfields ⇒ Object (readonly)
Returns the value of attribute subfields.
3 4 5 |
# File 'lib/marcxella/datafield.rb', line 3 def subfields @subfields end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
3 4 5 |
# File 'lib/marcxella/datafield.rb', line 3 def tag @tag end |
Instance Method Details
#ind_to_s(i) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/marcxella/datafield.rb', line 23 def ind_to_s(i) if i == ' ' return '#' end return i end |
#subfield(code) ⇒ Object
19 20 21 |
# File 'lib/marcxella/datafield.rb', line 19 def subfield(code) @subfields.select{|s| s.code == code } end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/marcxella/datafield.rb', line 15 def to_s "%s %s%s%s" % [@tag, ind_to_s(@ind1), ind_to_s(@ind2), @subfields.join('')] end |
#value ⇒ Object
11 12 13 |
# File 'lib/marcxella/datafield.rb', line 11 def value @subfields.map{|s| s.value}.join('') end |