Class: Libis::Tools::Metadata::FixField

Inherits:
Object
  • Object
show all
Defined in:
lib/libis/tools/metadata/fix_field.rb

Overview

Helper class for implementing a fixed field for MARC

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, datas) ⇒ FixField

Create new fixed field

Parameters:



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

#datasObject

Returns the value of attribute datas.



11
12
13
# File 'lib/libis/tools/metadata/fix_field.rb', line 11

def datas
  @datas
end

#tagObject (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

#dumpObject



27
28
29
# File 'lib/libis/tools/metadata/fix_field.rb', line 27

def dump
  "#{@tag}:'#{@datas}'\n"
end