source/Emoji/gemoji-parser/lib/gemoji-parser.rb
def parse(text, opts={})
    opts = { unicode: true, tokens: true, emoticons: true }.merge(opts)
    if opts.one?
      return parse_unicode(text)   { |e| yield e } if opts[:unicode]
      return parse_tokens(text)    { |e| yield e } if opts[:tokens]
      return parse_emoticons(text) { |e| yield e } if opts[:emoticons]
    end
    text.gsub(macro_regex(opts)) do |match|
      a = defined?($1) ? $1 : nil
      b = defined?($2) ? $2 : nil
      emoji = find(a || b)
      block_given? && emoji ? yield(emoji) : match
    end
  end
# Parses all emoji unicode, tokens, and emoticons within a string.
# - Block: performs all symbol transformations.
# - Options: unicode:boolean, tokens:boolean, emoticons:boolean
Parses all emoji unicode, tokens, and emoticons within a string.
Block: performs all symbol transformations.
Parses all emoji unicode tokens and emoticons within a string . Block : performs all symbol transformations .
def parse(text, opts={})
    opts = { unicode: true, tokens: true, emoticons: true }.merge(opts)
    if opts.one?
      return parse_unicode(text)   { |e| yield e } if opts[:unicode]
      return parse_tokens(text)    { |e| yield e } if opts[:tokens]
      return parse_emoticons(text) { |e| yield e } if opts[:emoticons]
    end
    text.gsub(macro_regex(opts)) do |match|
      a = defined?($1) ? $1 : nil
      b = defined?($2) ? $2 : nil
      emoji = find(a || b)
      block_given? && emoji ? yield(emoji) : match
    end
  end
def parse ( text , opts = { } ) opts = { unicode : true , tokens : true , emoticons : true } . merge ( opts ) if opts . one? return parse_unicode ( text ) { | e | yield e } if opts [ :unicode ] return parse_tokens ( text ) { | e | yield e } if opts [ :tokens ] return parse_emoticons ( text ) { | e | yield e } if opts [ :emoticons ] end text . gsub ( macro_regex ( opts ) ) do | match | a = defined? ( $1 ) ? $1 : nil b = defined? ( $2 ) ? $2 : nil emoji = find ( a || b ) block_given? && emoji ? yield ( emoji ) : match end end
Parses all emoji unicode, tokens, and emoticons within a string.
Parses all emoji unicode tokens and emoticons within a string .
text
opts