Commit ce802a99 by Mark Wunsch Committed by GitHub

Merge pull request #47 from redtail-technology/master

Updating rumoji library
parents d88e8e47 4914c7da
......@@ -6,9 +6,9 @@ require 'stringio'
module Rumoji
extend self
# Transform emoji into its cheat-sheet code
# Transform emoji into its cheat-sheet code (convert each entry to string first to handle hash values)
def encode(str)
str.gsub(Emoji::ALL_REGEXP) do |match|
str.to_s.gsub(Emoji::ALL_REGEXP) do |match|
if emoji = Emoji.find_by_string(match)
if block_given?
yield emoji
......@@ -21,9 +21,9 @@ module Rumoji
end
end
# Transform a cheat-sheet code into an Emoji
# Transform a cheat-sheet code into an Emoji (convert each entry to string first to handle hash values)
def decode(str)
str.gsub(/:([^\s:]?[\w-]+):/) { |match| (Emoji.find($1) || match).to_s }
str.to_s.gsub(/:([^\s:]?[\w-]+):/) { |match| (Emoji.find($1) || match).to_s }
end
def encode_io(readable, writeable=StringIO.new(""), &block)
......
......@@ -55,13 +55,15 @@ module Rumoji
other.symbol <=> symbol
end
autoload :FOOD, 'rumoji/emoji/food'
autoload :PEOPLE, 'rumoji/emoji/people'
autoload :NATURE, 'rumoji/emoji/nature'
autoload :OBJECTS, 'rumoji/emoji/objects'
autoload :PLACES, 'rumoji/emoji/places'
autoload :SYMBOLS, 'rumoji/emoji/symbols'
autoload :NEWMOJI, 'rumoji/emoji/newmoji'
ALL = PEOPLE | NATURE | OBJECTS | PLACES | SYMBOLS
ALL = PEOPLE | NATURE | OBJECTS | PLACES | SYMBOLS | FOOD | NEWMOJI
ALL_REGEXP = Regexp.new(ALL.map(&:string).join('|'))
......
require 'rumoji/emoji'
require 'set'
module Rumoji
class Emoji
FOOD = SortedSet[
self.new("\u{1F34E}", [:apple]),
self.new("\u{1f34c}", [:banana]),
self.new("\u{1f37a}", [:beer]),
self.new("\u{1f37b}", [:beers]),
self.new("\u{1f35e}", [:bread]),
self.new("\u{1f370}", [:cake]),
self.new("\u{1f36c}", [:candy]),
self.new("\u{1f352}", [:cherries]),
self.new("\u{1f36b}", [:chocolate_bar]),
self.new("\u{2615}" , [:coffee]),
self.new("\u{1f36a}", [:cookie]),
self.new("\u{1f33d}", [:corn]),
self.new("\u{1f35b}", [:curry]),
self.new("\u{1f36e}", [:custard]),
self.new("\u{1f369}", [:doughnut]),
self.new("\u{1f373}", [:egg]),
self.new("\u{1f346}", [:eggplant]),
self.new("\u{1f365}", [:fish_cake]),
self.new("\u{1f364}", [:fried_shrimp]),
self.new("\u{1f35f}", [:fries]),
self.new("\u{1f347}", [:grapes]),
self.new("\u{1f34f}", [:green_apple]),
self.new("\u{1f354}", [:hamburger]),
self.new("\u{1f36f}", [:honey_pot]),
self.new("\u{1f368}", [:ice_cream]),
self.new("\u{1f366}", [:icecream]),
self.new("\u{1f34b}", [:lemon]),
self.new("\u{1f36d}", [:lollipop]),
self.new("\u{1f348}", [:melon]),
self.new("\u{1f34d}", [:pineapple]),
self.new("\u{1f355}", [:pizza]),
self.new("\u{1f35c}", [:ramen]),
self.new("\u{1f35a}", [:rice]),
self.new("\u{1f359}", [:rice_ball]),
self.new("\u{1f358}", [:rice_cracker]),
self.new("\u{1f376}", [:sake]),
self.new("\u{1f367}", [:shaved_ice]),
self.new("\u{1f35d}", [:spaghetti]),
self.new("\u{1f372}", [:stew]),
self.new("\u{1f353}", [:strawberry]),
self.new("\u{1f363}", [:sushi]),
self.new("\u{1f360}", [:sweet_potato]),
self.new("\u{1f34a}", [:tangerine]),
self.new("\u{1f375}", [:tea]),
self.new("\u{1f345}", [:tomato]),
self.new("\u{1f379}", [:tropical_drink]),
self.new("\u{1f349}", [:watermelon]),
self.new("\u{1f377}", [:wine_glass]),
self.new("\u{1f336}", [:hot_pepper]),
self.new("\u{1f9c0}", [:cheese_wedge]),
self.new("\u{1f32d}", [:hot_dog, :hotdog]),
self.new("\u{1f32e}", [:taco]),
self.new("\u{1f32f}", [:burrito]),
self.new("\u{1f37f}", [:popcorn]),
self.new("\u{1F95D}", [:kiwifruit]),
self.new("\u{1F951}", [:avocado]),
self.new("\u{1F952}", [:cucumber]),
self.new("\u{1F955}", [:carrot] ),
self.new("\u{1F956}", [:baguette_bread]),
self.new("\u{1F954}", [:potato]),
self.new("\u{1F95A}", [:egg]),
self.new("\u{1F95C}", [:peanuts]),
self.new("\u{1F953}", [:bacon], "BACON"),
self.new("\u{1F950}", [:croissant]),
self.new("\u{1F95E}", [:pancakes]),
self.new("\u{1F957}", [:green_salad]),
self.new("\u{1F959}", [:stuffed_flatbread]),
self.new("\u{1F943}", [:tumbler_glass]),
self.new("\u{1F942}", [:clinking_glasses]),
self.new("\u{1F95B}", [:glass_of_milk]),
]
end
end
\ No newline at end of file
......@@ -22,19 +22,15 @@ module Rumoji
self.new("\u{1F385}", [:santa], "FATHER CHRISTMAS"), # "Santa Claus"
self.new("\u{1f3b1}", [:"8ball"]),
self.new("\u{23f0}" , [:alarm_clock]),
self.new("\u{1f34e}", [:apple]),
self.new("\u{1f3a8}", [:art]),
self.new("\u{1f37c}", [:baby_bottle]),
self.new("\u{1f388}", [:balloon]),
self.new("\u{1f34c}", [:banana]),
self.new("\u{1f4ca}", [:bar_chart]),
self.new("\u{26be}" , [:baseball]),
self.new("\u{1f3c0}", [:basketball]),
self.new("\u{1f6c0}", [:bath]),
self.new("\u{1f6c1}", [:bathtub]),
self.new("\u{1f50b}", [:battery]),
self.new("\u{1f37a}", [:beer]),
self.new("\u{1f37b}", [:beers]),
self.new("\u{1f514}", [:bell]),
self.new("\u{1f371}", [:bento]),
self.new("\u{1f6b4}", [:bicyclist]),
......@@ -49,20 +45,15 @@ module Rumoji
self.new("\u{1f4da}", [:books]),
self.new("\u{1f462}", [:boot]),
self.new("\u{1f3b3}", [:bowling]),
self.new("\u{1f35e}", [:bread]),
self.new("\u{1f4bc}", [:briefcase]),
self.new("\u{1f4a1}", [:bulb]),
self.new("\u{1f370}", [:cake]),
self.new("\u{1f4c6}", [:calendar]),
self.new("\u{1f4f2}", [:calling]),
self.new("\u{1f4f7}", [:camera]),
self.new("\u{1f36c}", [:candy]),
self.new("\u{1f4c7}", [:card_index]),
self.new("\u{1f4bf}", [:cd]),
self.new("\u{1f4c9}", [:chart_with_downwards_trend]),
self.new("\u{1f4c8}", [:chart_with_upwards_trend]),
self.new("\u{1f352}", [:cherries]),
self.new("\u{1f36b}", [:chocolate_bar]),
self.new("\u{1f384}", [:christmas_tree]),
self.new("\u{1f3ac}", [:clapper]),
self.new("\u{1f4cb}", [:clipboard]),
......@@ -71,53 +62,39 @@ module Rumoji
self.new("\u{1f302}", [:closed_umbrella]),
self.new("\u{2663}" , [:clubs]),
self.new("\u{1f378}", [:cocktail]),
self.new("\u{2615}" , [:coffee]),
self.new("\u{1f4bb}", [:computer]),
self.new("\u{1f38a}", [:confetti_ball]),
self.new("\u{1f36a}", [:cookie]),
self.new("\u{1f33d}", [:corn]),
self.new("\u{1f4b3}", [:credit_card]),
self.new("\u{1f451}", [:crown]),
self.new("\u{1f52e}", [:crystal_ball]),
self.new("\u{1f35b}", [:curry]),
self.new("\u{1f36e}", [:custard]),
self.new("\u{1f361}", [:dango]),
self.new("\u{1f3af}", [:dart]),
self.new("\u{1f4c5}", [:date]),
self.new("\u{2666}" , [:diamonds]),
self.new("\u{1f4b5}", [:dollar]),
self.new("\u{1f6aa}", [:door]),
self.new("\u{1f369}", [:doughnut]),
self.new("\u{1f457}", [:dress]),
self.new("\u{1f4c0}", [:dvd]),
self.new("\u{1f4e7}", [:"e-mail"]),
self.new("\u{1f373}", [:egg]),
self.new("\u{1f346}", [:eggplant]),
self.new("\u{1f50c}", [:electric_plug]),
self.new("\u{2709}" , [:email, :envelope]),
self.new("\u{1f4b6}", [:euro]),
self.new("\u{1f453}", [:eyeglasses]),
self.new("\u{1f4e0}", [:fax]),
self.new("\u{1f4c1}", [:file_folder]),
self.new("\u{1f365}", [:fish_cake]),
self.new("\u{1f3a3}", [:fishing_pole_and_fish]),
self.new("\u{1f526}", [:flashlight]),
self.new("\u{1f4be}", [:floppy_disk]),
self.new("\u{1f3b4}", [:flower_playing_cards]),
self.new("\u{1f3c8}", [:football]),
self.new("\u{1f374}", [:fork_and_knife]),
self.new("\u{1f364}", [:fried_shrimp]),
self.new("\u{1f35f}", [:fries]),
self.new("\u{1f3b2}", [:game_die]),
self.new("\u{1f48e}", [:gem]),
self.new("\u{1f381}", [:gift]),
self.new("\u{26f3}" , [:golf]),
self.new("\u{1f347}", [:grapes]),
self.new("\u{1f34f}", [:green_apple]),
self.new("\u{1f4d7}", [:green_book]),
self.new("\u{1f3b8}", [:guitar]),
self.new("\u{1f52b}", [:gun]),
self.new("\u{1f354}", [:hamburger]),
self.new("\u{1f528}", [:hammer]),
self.new("\u{1f45c}", [:handbag]),
self.new("\u{1f3a7}", [:headphones]),
......@@ -125,12 +102,9 @@ module Rumoji
self.new("\u{1f506}", [:high_brightness]),
self.new("\u{1f460}", [:high_heel]),
self.new("\u{1f52a}", [:hocho]),
self.new("\u{1f36f}", [:honey_pot]),
self.new("\u{1f3c7}", [:horse_racing]),
self.new("\u{231b}" , [:hourglass]),
self.new("\u{23f3}" , [:hourglass_flowing_sand]),
self.new("\u{1f368}", [:ice_cream]),
self.new("\u{1f366}", [:icecream]),
self.new("\u{1f4e5}", [:inbox_tray]),
self.new("\u{1f4e8}", [:incoming_envelope]),
self.new("\u{1f4f1}", [:iphone]),
......@@ -138,11 +112,9 @@ module Rumoji
self.new("\u{1f511}", [:key]),
self.new("\u{1f458}", [:kimono]),
self.new("\u{1f4d2}", [:ledger]),
self.new("\u{1f34b}", [:lemon]),
self.new("\u{1f484}", [:lipstick]),
self.new("\u{1f512}", [:lock]),
self.new("\u{1f50f}", [:lock_with_ink_pen]),
self.new("\u{1f36d}", [:lollipop]),
self.new("\u{27bf}" , [:loop]),
self.new("\u{1f4e2}", [:loudspeaker]),
self.new("\u{1f505}", [:low_brightness]),
......@@ -156,7 +128,6 @@ module Rumoji
self.new("\u{1f45e}", [:mans_shoe, :shoe]),
self.new("\u{1f356}", [:meat_on_bone]),
self.new("\u{1f4e3}", [:mega]),
self.new("\u{1f348}", [:melon]),
self.new("\u{1f4dd}", [:memo, :pencil]),
self.new("\u{1f3a4}", [:microphone]),
self.new("\u{1f52c}", [:microscope]),
......@@ -188,8 +159,6 @@ module Rumoji
self.new("\u{270f}" , [:pencil2]),
self.new("\u{260e}" , [:phone, :telephone]),
self.new("\u{1f48a}", [:pill]),
self.new("\u{1f34d}", [:pineapple]),
self.new("\u{1f355}", [:pizza]),
self.new("\u{1f4ef}", [:postal_horn]),
self.new("\u{1f4ee}", [:postbox]),
self.new("\u{1f45d}", [:pouch]),
......@@ -198,22 +167,16 @@ module Rumoji
self.new("\u{1f45b}", [:purse]),
self.new("\u{1f4cc}", [:pushpin]),
self.new("\u{1f4fb}", [:radio]),
self.new("\u{1f35c}", [:ramen]),
self.new("\u{1f380}", [:ribbon]),
self.new("\u{1f35a}", [:rice]),
self.new("\u{1f359}", [:rice_ball]),
self.new("\u{1f358}", [:rice_cracker]),
self.new("\u{1f48d}", [:ring]),
self.new("\u{1f3c9}", [:rugby_football]),
self.new("\u{1f3bd}", [:running_shirt_with_sash]),
self.new("\u{1f376}", [:sake]),
self.new("\u{1f461}", [:sandal]),
self.new("\u{1f4e1}", [:satellite]),
self.new("\u{1f3b7}", [:saxophone]),
self.new("\u{2702}" , [:scissors]),
self.new("\u{1f4dc}", [:scroll]),
self.new("\u{1f4ba}", [:seat]),
self.new("\u{1f367}", [:shaved_ice]),
self.new("\u{1f455}", [:shirt, :tshirt]),
self.new("\u{1f6bf}", [:shower]),
self.new("\u{1f3bf}", [:ski]),
......@@ -223,29 +186,20 @@ module Rumoji
self.new("\u{1f509}", [:sound, :speaker_with_one_sound_wave]),
self.new("\u{1f47e}", [:space_invader]),
self.new("\u{2660}" , [:spades]),
self.new("\u{1f35d}", [:spaghetti]),
self.new("\u{1f50a}", [:speaker, :speaker_with_three_sound_waves]),
self.new("\u{1f372}", [:stew]),
self.new("\u{1f4cf}", [:straight_ruler]),
self.new("\u{1f353}", [:strawberry]),
self.new("\u{1f3c4}", [:surfer]),
self.new("\u{1f363}", [:sushi]),
self.new("\u{1f360}", [:sweet_potato]),
self.new("\u{1f3ca}", [:swimmer]),
self.new("\u{1f489}", [:syringe]),
self.new("\u{1f389}", [:tada]),
self.new("\u{1f38b}", [:tanabata_tree]),
self.new("\u{1f34a}", [:tangerine]),
self.new("\u{1f375}", [:tea]),
self.new("\u{1f4de}", [:telephone_receiver]),
self.new("\u{1f52d}", [:telescope]),
self.new("\u{1f3be}", [:tennis]),
self.new("\u{1f6bd}", [:toilet]),
self.new("\u{1f345}", [:tomato]),
self.new("\u{1f3a9}", [:tophat]),
self.new("\u{1f4d0}", [:triangular_ruler]),
self.new("\u{1f3c6}", [:trophy]),
self.new("\u{1f379}", [:tropical_drink]),
self.new("\u{1f3ba}", [:trumpet]),
self.new("\u{1f4fa}", [:tv]),
self.new("\u{1f513}", [:unlock]),
......@@ -254,20 +208,12 @@ module Rumoji
self.new("\u{1f3ae}", [:video_game]),
self.new("\u{1f3bb}", [:violin]),
self.new("\u{231a}" , [:watch]),
self.new("\u{1f349}", [:watermelon]),
self.new("\u{1f377}", [:wine_glass]),
self.new("\u{1f45a}", [:womans_clothes]),
self.new("\u{1f452}", [:womans_hat]),
self.new("\u{1f527}", [:wrench]),
self.new("\u{1f4b4}", [:yen]),
self.new("\u{1f6CD}", [:shopping_bags], "SHOPPING BAGS"),
self.new("\u{1f4ff}", [:prayer_beads], "PRAYER BEADS"),
self.new("\u{1f336}", [:hot_pepper]),
self.new("\u{1f9c0}", [:cheese_wedge]),
self.new("\u{1f32d}", [:hot_dog, :hotdog]),
self.new("\u{1f32e}", [:taco]),
self.new("\u{1f32f}", [:burrito]),
self.new("\u{1f37f}", [:popcorn]),
self.new("\u{1f37e}", [:bottle_popping_cork, :champagne]),
self.new("\u{1f3fa}", [:amphora]),
self.new("\u{1f579}", [:joystick]),
......
......@@ -112,7 +112,7 @@ module Rumoji
self.new("\u{1F574}", [:man_levitating, :man_in_business_suit_levitating], "MAN IN BUSINESS SUIT LEVITATING"),
self.new("\u{1F641}", [:slightly_frowning, :slightly_frowning_face], "SLIGHTLY FROWNING FACE"),
self.new("\u{1F642}", [:slightly_smiling, :slightly_smiling_face], "SLIGHTLY SMILING FACE"),
self.new("\u{1F920}", [:face_with_cowboy_hat], "COWBOY HAT FACE"),
# Poop
self.new("\u{1F4A9}", [:poop, :hankey, :shit], "PILE OF POO"), # "dog dirt"
self.new("\u{1F44D}", [:thumbsup, :"+1"], "THUMBS UP SIGN"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment