Class: Libis::Metadata::FixField
- Inherits:
-
Object
- Object
- Libis::Metadata::FixField
- Defined in:
- lib/libis/metadata/fix_field.rb
Overview
Helper class for implementing a fixed field for MARC
Instance Attribute Summary collapse
-
#datas ⇒ Object
Returns the value of attribute datas.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #[](from = nil, to = nil) ⇒ Object
- #dump ⇒ Object
-
#initialize(tag, datas) ⇒ FixField
constructor
Create new fixed field.
Constructor Details
#initialize(tag, datas) ⇒ FixField
Create new fixed field
15 16 17 18 |
# File 'lib/libis/metadata/fix_field.rb', line 15 def initialize(tag, datas) @tag = tag @datas = datas || '' end |
Instance Attribute Details
#datas ⇒ Object
Returns the value of attribute datas.
10 11 12 |
# File 'lib/libis/metadata/fix_field.rb', line 10 def datas @datas end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
9 10 11 |
# File 'lib/libis/metadata/fix_field.rb', line 9 def tag @tag end |
Instance Method Details
#[](from = nil, to = nil) ⇒ Object
21 22 23 24 |
# File 'lib/libis/metadata/fix_field.rb', line 21 def [](from = nil, to = nil) return @datas unless from to ? @datas[from..to] : @datas[from] end |
#dump ⇒ Object
26 27 28 |
# File 'lib/libis/metadata/fix_field.rb', line 26 def dump "#{@tag}:'#{@datas}'\n" end |