Sha256: 93b53f966acb6326e9915a16bdc6caffabfe2d7bd91b4e2734350bb64f59dce9

Contents?: true

Size: 652 Bytes

Versions: 2

Compression:

Stored size: 652 Bytes

Contents

# frozen_string_literal: true

class BinaryCharacteristics < Characteristics
  BLANKS = [
    0x9,
    0x20,
  ].freeze

  SEPARATORS = [
    0xA,
    0xB,
    0xC,
    0xD,
  ].freeze

  def initialize(char)
    @ord = char.ord
    @encoding = char.encoding
    @encoding_name = @encoding.name
  end

  def valid?
    true
  end

  def unicode?
    false
  end

  def assigned?
    true
  end

  def control?
    c0? || delete?
  end

  def c0?
    @ord < 0x20
  end

  def delete?
    @ord == 0x7F
  end

  def blank?
    BLANKS.include?(@ord) || SEPARATORS.include?(@ord)
  end

  def format?
    false
  end

  def bidi_control?
    false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
characteristics-0.5.2 lib/characteristics/binary.rb
characteristics-0.5.1 lib/characteristics/binary.rb