Sha256: 4fb344285404608ece36206afad5ab4d354fed2a8c46891dfb985b340c3ed4a9

Contents?: true

Size: 772 Bytes

Versions: 23

Compression:

Stored size: 772 Bytes

Contents

module RelatonBib
  class Place
    # @return [String]
    attr_reader :name

    # @return [String, NilClass]
    attr_reader :uri, :region

    # @param name [String]
    # @param uri [String, NilClass]
    # @param region [String, NilClass]
    def initialize(name:, uri: nil, region: nil)
      @name   = name
      @uri    = uri
      @region = region
    end

    # @param builder [Nologiri::XML::Builder]
    def to_xml(builder)
      xml = builder.place name
      xml[:uri] = uri if uri
      xml[:region] = region if region
    end

    # @return [Hash]
    def to_hash
      if uri || region
        hash = { name: name }
        hash["uri"] = uri if uri
        hash["region"] = region if region
        hash
      else
        name
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/relaton-bib-1.2.4/lib/relaton_bib/place.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/relaton-bib-1.2.4/lib/relaton_bib/place.rb
relaton-bib-1.2.4 lib/relaton_bib/place.rb
relaton-bib-1.2.2 lib/relaton_bib/place.rb
relaton-bib-1.2.1 lib/relaton_bib/place.rb
relaton-bib-1.2.0 lib/relaton_bib/place.rb
relaton-bib-1.1.1 lib/relaton_bib/place.rb
relaton-bib-1.1.0 lib/relaton_bib/place.rb
relaton-bib-1.0.4 lib/relaton_bib/place.rb
relaton-bib-1.0.3 lib/relaton_bib/place.rb
relaton-bib-1.0.2 lib/relaton_bib/place.rb
relaton-bib-1.0.1 lib/relaton_bib/place.rb
relaton-bib-1.0.0 lib/relaton_bib/place.rb
relaton-bib-0.9.2 lib/relaton_bib/place.rb
relaton-bib-0.9.1 lib/relaton_bib/place.rb
relaton-bib-0.9.0 lib/relaton_bib/place.rb
relaton-bib-0.8.1 lib/relaton_bib/place.rb
relaton-bib-0.8.0 lib/relaton_bib/place.rb
relaton-bib-0.7.0 lib/relaton_bib/place.rb
relaton-bib-0.6.0 lib/relaton_bib/place.rb