class Resolv::LOC::Size

Parent:
Object

A Resolv::LOC::Size

Constants

Regex

Attributes

scalar[R]

The raw size

Public Class Methods

create(arg) Show source
# File lib/resolv.rb, line 2663
def self.create(arg)
  case arg
  when Size
    return arg
  when String
    scalar = ''
    if Regex =~ arg
      scalar = [(($1.to_f*(1e2)).to_i.to_s[0].to_i*(2**4)+(($1.to_f*(1e2)).to_i.to_s.length-1))].pack("C")
    else
      raise ArgumentError.new("not a properly formed Size string: " + arg)
    end
    return Size.new(scalar)
  else
    raise ArgumentError.new("cannot interpret as Size: #{arg.inspect}")
  end
end

Creates a new LOC::Size from arg which may be:

LOC::Size

returns arg.

String

arg must match the LOC::Size::Regex constant

new(scalar) Show source
# File lib/resolv.rb, line 2680
def initialize(scalar)
  @scalar = scalar
end

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.