Sha256: b3f907d9518ff0167f6c71b09678760fbd3be98fcedfbc93bd10ab7052821cc4

Contents?: true

Size: 608 Bytes

Versions: 2

Compression:

Stored size: 608 Bytes

Contents

class SequenceBase
  # Format:
  # codepoints ; # (sequence) description
  SEQUENCE_REGEXP = %r{
    (?<codepoints>.+)
    \#
    \s{1}
    \(
      (?<sequence>.+)
    \)
    \s{1}
    (?<description>.+)
  }x.freeze

  attr_reader :raw, :codepoints, :sequence, :description

  def initialize(raw)
    @raw = raw
    matched = raw.match(SEQUENCE_REGEXP)

    @codepoints = matched[:codepoints].rstrip
    @sequence = matched[:sequence]
    @description = matched[:description]
  end

  def to_h
    Hash(
      codepoints: codepoints,
      sequence: sequence,
      description: description
    )
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
emoji-data-1.0.0 lib/emoji/data/sequence_base.rb
emoji-data-0.1.0 lib/emoji/data/sequence_base.rb