Class: Libis::Tools::Metadata::FixField
- Defined in:
- lib/libis/tools/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
16 17 18 19 |
# File 'lib/libis/tools/metadata/fix_field.rb', line 16 def initialize(tag, datas) @tag = tag @datas = datas || '' end |
Instance Attribute Details
#datas ⇒ Object
Returns the value of attribute datas.
11 12 13 |
# File 'lib/libis/tools/metadata/fix_field.rb', line 11 def datas @datas end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
10 11 12 |
# File 'lib/libis/tools/metadata/fix_field.rb', line 10 def tag @tag end |
Instance Method Details
#[](from = nil, to = nil) ⇒ Object
22 23 24 25 |
# File 'lib/libis/tools/metadata/fix_field.rb', line 22 def [](from = nil, to = nil) return @datas unless from to ? @datas[from..to] : @datas[from] end |
#dump ⇒ Object
27 28 29 |
# File 'lib/libis/tools/metadata/fix_field.rb', line 27 def dump "#{@tag}:'#{@datas}'\n" end |