Sha256: 2a6dda19aeeea5d3419c92fd4f8aa29cebb1856af6ff95c59b2a0dd799f69f17

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 KB

Contents

module RelatonBib
  # class SpecificLocalityType
  #   SECTION   = 'section'
  #   CLAUSE    = 'clause'
  #   PART      = 'part'
  #   PARAGRAPH = 'paragraph'
  #   CHAPTER   = 'chapter'
  #   PAGE      = 'page'
  #   WHOLE     = 'whole'
  #   TABLE     = 'table'
  #   ANNEX     = 'annex'
  #   FIGURE    = 'figure'
  #   NOTE      = 'note'
  #   EXAMPLE   = 'example'
  #   # generic String is allowed
  # end

  # Bibliographic item locality.
  class BibItemLocality
    # @return [RelatonBib::SpecificLocalityType]
    attr_reader :type

    # @return [RelatonBib::LocalizedString]
    attr_reader :reference_from

    # @return [RelatonBib::LocalizedString]
    attr_reader :reference_to

    # @param type [String]
    # @param referenceFrom [String]
    # @param referenceTo [String]
    def initialize(type, reference_from, reference_to = nil)
      @type           = type
      @reference_from = reference_from
      @reference_to   = reference_to
    end

    # @param builder [Nokogiri::XML::Builder]
    def to_xml(builder)
      builder.locality(type: type) do
        builder.referenceFrom reference_from # { reference_from.to_xml(builder) }
        builder.referenceTo reference_to if reference_to
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
relaton-bib-0.3.3 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.3.2 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.3.1 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.3.0 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.2.5 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.2.4 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.2.3 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.2.2 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.2.1 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.2.0 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.1.6 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.1.5 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.1.3 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.1.2 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.1.1 lib/relaton_bib/bib_item_locality.rb
relaton-bib-0.1.0 lib/relaton_bib/bib_item_locality.rb