Sha256: b420f6801657ae4c8b47da861c2dbbb948c456b37f67b863cb3f294559e82286
Contents?: true
Size: 698 Bytes
Versions: 2
Compression:
Stored size: 698 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 alias_method :to_s, :char end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
emoji_data-0.0.3 | lib/emoji_data/emoji_char.rb |
emoji_data-0.0.2 | lib/emoji_data/emoji_char.rb |