Sha256: fd02c7f150bd148e78079b4d84d4f8679ad7f0a5e30aa233051e6c01e42921ba

Contents?: true

Size: 521 Bytes

Versions: 2

Compression:

Stored size: 521 Bytes

Contents

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 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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
characteristics-0.2.0 lib/characteristics/binary.rb
characteristics-0.1.0 lib/characteristics/binary.rb