Sha256: 2da567ea15de35c5305d383d5663c39c4b619bdeb8ebd03bd7dbc726f97731df
Contents?: true
Size: 1.83 KB
Versions: 2
Compression:
Stored size: 1.83 KB
Contents
# frozen_string_literal: true # # Copyright (c) 2006-2022 Hal Brodigan (postmodern.mod3 at gmail.com) # # Ronin Support is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ronin Support is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with Ronin Support. If not, see <http://www.gnu.org/licenses/>. # require 'ronin/support/encoding/c' class Integer # # Escapes the Integer as a C character. # # @return [String] # The escaped C character. # # @raise [RangeError] # The integer value is negative. # # @example # 0x41.c_escape # # => "A" # 0x22.c_escape # # => "\\\"" # 0x7f.c_escape # # => "\\x7F" # # @example Escaping unicode characters: # 0xffff.c_escape # # => "\\uFFFF" # 0x10000.c_escape # # => "\\U000100000" # # @see Ronin::Support::Encoding::C.escape_byte # # @since 1.0.0 # # @api public # def c_escape Ronin::Support::Encoding::C.escape_byte(self) end alias c_char c_escape # # Formats the Integer as a C escaped String. # # @return [String] # The escaped C character. # # @example # 0x41.c_encode # # => "\\x41" # 0x100.c_encode # # => "\\u1000" # 0x10000.c_encode # # => "\\U000100000" # # @see Ronin::Support::Encoding::C.encode_byte # # @since 1.0.0 # # @api public # def c_encode Ronin::Support::Encoding::C.encode_byte(self) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ronin-support-1.0.0.beta2 | lib/ronin/support/encoding/c/core_ext/integer.rb |
ronin-support-1.0.0.beta1 | lib/ronin/support/encoding/c/core_ext/integer.rb |