Class: IsoBibItem::BibItemLocality

Inherits:
Object
  • Object
show all
Defined in:
lib/iso_bib_item/document_relation_collection.rb

Overview

Bibliographic item locality.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, reference_from, reference_to = nil) ⇒ BibItemLocality

Returns a new instance of BibItemLocality.

Parameters:



47
48
49
50
51
# File 'lib/iso_bib_item/document_relation_collection.rb', line 47

def initialize(type, reference_from, reference_to = nil)
  @type           = type
  @reference_from = reference_from
  @reference_to   = reference_to
end

Instance Attribute Details

#reference_fromIsoBibItem::LocalizedString (readonly)



39
40
41
# File 'lib/iso_bib_item/document_relation_collection.rb', line 39

def reference_from
  @reference_from
end

#reference_toIsoBibItem::LocalizedString (readonly)



42
43
44
# File 'lib/iso_bib_item/document_relation_collection.rb', line 42

def reference_to
  @reference_to
end

#typeIsoBibItem::SpecificLocalityType (readonly)

Returns:

  • (IsoBibItem::SpecificLocalityType)


36
37
38
# File 'lib/iso_bib_item/document_relation_collection.rb', line 36

def type
  @type
end

Instance Method Details

#to_xml(builder) ⇒ Object



53
54
55
56
57
58
# File 'lib/iso_bib_item/document_relation_collection.rb', line 53

def to_xml(builder)
  builder.locality(type: type) do
    builder.referenceFrom { reference_from.to_xml(builder) }
    builder.referenceTo reference_to if reference_to
  end
end