Sha256: a23e5d89898c1e7cf5ad5beadd1b46e4a7045349bd8cfee4ed870022ba609e78

Contents?: true

Size: 473 Bytes

Versions: 6

Compression:

Stored size: 473 Bytes

Contents

require 'xml/mapping'
require 'stash/wrapper/size_unit'

module Stash
  module Wrapper

    # Mapping for `<st:size>`
    class Size
      include ::XML::Mapping

      numeric_node :size, '.'
      typesafe_enum_node :unit, '@unit', class: SizeUnit, default: SizeUnit::BYTE

      # Creates a new {Size}
      # @param bytes [Integer] the size in bytes
      def initialize(bytes:)
        self.size = bytes
        self.unit = SizeUnit::BYTE
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stash-wrapper-0.1.9 lib/stash/wrapper/size.rb
stash-wrapper-0.1.8 lib/stash/wrapper/size.rb
stash-wrapper-0.1.7 lib/stash/wrapper/size.rb
stash-wrapper-0.1.6 lib/stash/wrapper/size.rb
stash-wrapper-0.1.5 lib/stash/wrapper/size.rb
stash-wrapper-0.1.4 lib/stash/wrapper/size.rb