Sha256: 240a3b8a13525adc30a8740994024875c390ad70409a9767e7e3052bb6b0676a

Contents?: true

Size: 733 Bytes

Versions: 13

Compression:

Stored size: 733 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 c1?
    false
  end

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

  def separator?
    SEPARATORS.include?(@ord)
  end

  def format?
    false
  end

  def bidi_control?
    false
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
characteristics-1.7.1 lib/characteristics/binary.rb
characteristics-1.7.0 lib/characteristics/binary.rb
characteristics-1.6.0 lib/characteristics/binary.rb
characteristics-1.5.0 lib/characteristics/binary.rb
characteristics-1.4.1 lib/characteristics/binary.rb
characteristics-1.4.0 lib/characteristics/binary.rb
characteristics-1.3.0 lib/characteristics/binary.rb
characteristics-1.2.0 lib/characteristics/binary.rb
characteristics-1.1.0 lib/characteristics/binary.rb
characteristics-1.0.0 lib/characteristics/binary.rb
characteristics-0.8.0 lib/characteristics/binary.rb
characteristics-0.7.0 lib/characteristics/binary.rb
characteristics-0.6.0 lib/characteristics/binary.rb