Sha256: 66a78188002f33bea8685c0f0ad740b0b78d06843aa189b6707017d567214007

Contents?: true

Size: 507 Bytes

Versions: 3

Compression:

Stored size: 507 Bytes

Contents

require 'json'

class Emoji

	@@emoji = {}

	@@current_list = "all"

	def self.square(size)
		list = @@emoji[@@current_list]
		square = ""
		(0...(size ** 2)).each do |i|
			square << list.sample
			if ((i + 1) % size) == 0
				square << "\n"
			end
		end
		return square
	end

	def self.choose(list)
		@@current_list = list
	end

	def self.list
		@@emoji.keys
	end

	def self.load(path)
		file = File.read(path)
		@@emoji = JSON.parse(file)
	end

end

# Load emoji sets
Emoji.load('./lib/json/emoji.json')

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-bot-manager-0.1.0pre5 examples/emoji-art-bot/lib/emoji.rb
slack-bot-manager-0.1.0pre4 examples/emoji-art-bot/lib/emoji.rb
slack-bot-manager-0.1.0pre3 examples/emoji-art-bot/lib/emoji.rb