Sha256: 32beb76ed597e2ecbe5c6ae9857cddfd7b71d59044a492182b549c09414eaed9

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

module EmojiData

  class EmojiChar
    def initialize(emoji_hash)
      # http://stackoverflow.com/questions/1615190/declaring-instance-variables-iterating-over-a-hash
      emoji_hash.each do |k,v|
        instance_variable_set("@#{k}",v)
        eigenclass = class<<self; self; end
        eigenclass.class_eval { attr_reader k }
      end
    end

    # Public: Returns a version of the character for rendering to screen.
    def char
      @char ||= @unified.split('-').map { |i| i.hex }.pack("U*")
    end

    # Public: Is the character represented by a doublebyte unicode codepoint in unicode?
    def doublebyte?
      @unified.match(/-/)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
emoji_data-0.0.1 lib/emoji_data/emoji_char.rb
emoji_data-0.0.1pre1 lib/emoji_data/emoji_char.rb