Class: RelatonIec::CitationType

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_iec/basic_block/citation_type.rb

Direct Known Subclasses

ErefType

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bibitemid:, locality:, date: nil) ⇒ CitationType

Returns a new instance of CitationType.

Parameters:

  • bibitemid (String)
  • locality (Array<RelatonBib::Locality, RelatonBib::LocalityStack>)
  • date (String, nil) (defaults to: nil)


17
18
19
20
21
# File 'lib/relaton_iec/basic_block/citation_type.rb', line 17

def initialize(bibitemid:, locality:, date: nil)
  @bibitemid = bibitemid
  @locality = locality
  @date = date
end

Instance Attribute Details

#bibitemidString (readonly)

Returns:

  • (String)


4
5
6
# File 'lib/relaton_iec/basic_block/citation_type.rb', line 4

def bibitemid
  @bibitemid
end

#dateString? (readonly)

Returns:

  • (String, nil)


10
11
12
# File 'lib/relaton_iec/basic_block/citation_type.rb', line 10

def date
  @date
end

#localityArray<elatonBib::Locality, RelatonBib::LocalityStack> (readonly)

Returns:

  • (Array<elatonBib::Locality, RelatonBib::LocalityStack>)


7
8
9
# File 'lib/relaton_iec/basic_block/citation_type.rb', line 7

def locality
  @locality
end

Instance Method Details

#to_xml(builder) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Builder)


26
27
28
29
30
# File 'lib/relaton_iec/basic_block/citation_type.rb', line 26

def to_xml(builder)
  builder.parent[:bibitemid] = bibitemid
  locality.each { |l| l.to_xml builder }
  builder.date date if date
end