Class: Resolv::LOC::Size
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/resolv.rb |
Overview
A Size
Constant Summary
-
Regex =
# File 'lib/resolv.rb', line 2662/^(\d+\.*\d*)[m]$/
Class Method Summary
-
.create(arg)
Creates a new
Size
fromarg
which may be: - .new(scalar) ⇒ Size constructor
Instance Attribute Summary
-
#scalar
readonly
The raw size.
Constructor Details
.new(scalar) ⇒ Size
Class Method Details
.create(arg)
Creates a new Size
from arg
which may be:
- LOC::Size
-
returns
arg
. - String
-
arg
must match the Regex constant
# File 'lib/resolv.rb', line 2670
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
Instance Attribute Details
#scalar (readonly)
The raw size
# File 'lib/resolv.rb', line 2694
attr_reader :scalar