Sha256: 2d42083ab4bdde7b408d93a9af06fe3f470024d2541c4680e5f6b52450f648d4

Contents?: true

Size: 741 Bytes

Versions: 1

Compression:

Stored size: 741 Bytes

Contents

module RelatonBib
  class Medium
    # @return [String, NilClass]
    attr_reader :form, :size, :scale

    # @param form [String, NilClass]
    # @param size [String, NilClass]
    # @param scale [String, NilClass]
    def initialize(form: nil, size: nil, scale: nil)
      @form  = form
      @size  = size
      @scale = scale
    end

    # @param builder [Nokogiri::XML::Builder]
    def to_xml(builder)
      builder.medium do
        builder.form form if form
        builder.size size if size
        builder.scale scale if scale
      end
    end

    # @return [Hash]
    def to_hash
      hash = {}
      hash[:form] = form if form
      hash[:size] = size if size
      hash[:scale] = scale if scale
      hash
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
relaton-bib-0.3.4 lib/relaton_bib/medium.rb