Class: PennMARC::InventoryEntry::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/pennmarc/helpers/inventory_entry/base.rb

Overview

Base class for InventoryEntry classes, defines required interface

Direct Known Subclasses

Electronic, Physical

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(inventory_field, source) ⇒ Base

Returns a new instance of Base.

Parameters:

  • inventory_field (MARC::DataField)
  • source (Symbol)


11
12
13
14
15
# File 'lib/pennmarc/helpers/inventory_entry/base.rb', line 11

def initialize(inventory_field, source)
  @source = source
  @field = inventory_field
  @mapper = @source == :api ? Enriched::Api : Enriched::Pub
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



7
8
9
# File 'lib/pennmarc/helpers/inventory_entry/base.rb', line 7

def field
  @field
end

#mapperObject (readonly)

Returns the value of attribute mapper.



7
8
9
# File 'lib/pennmarc/helpers/inventory_entry/base.rb', line 7

def mapper
  @mapper
end

#sourceObject (readonly)

Returns the value of attribute source.



7
8
9
# File 'lib/pennmarc/helpers/inventory_entry/base.rb', line 7

def source
  @source
end

Instance Method Details

#to_hHash

Returns:

  • (Hash)

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/pennmarc/helpers/inventory_entry/base.rb', line 18

def to_h
  raise NotImplementedError
end