class Hexdump::FormatString
@api private
@since 1.0.0
Public Class Methods
new(fmt)
click to toggle source
Initializes the format string.
@param [String] fmt
The format string.
# File lib/hexdump/format_string.rb, line 15 def initialize(fmt) @fmt = fmt end
Public Instance Methods
%(value)
click to toggle source
Formats the given value.
@param [Integer, Float] value
The given value.
@return [String]
The formatted value.
# File lib/hexdump/format_string.rb, line 28 def %(value) sprintf(@fmt,value) end
to_s()
click to toggle source
Converts the format string back into a String
.
@return [String]
The raw format string.
# File lib/hexdump/format_string.rb, line 38 def to_s @fmt end