emoruby 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd782a7a3726759ec5cbd3eec6a12c90a63a5db4
4
- data.tar.gz: 69eab3dbe410e976a3537c1fb34e507c18e2201d
3
+ metadata.gz: 2d66fce3f25c6be04ca7cbde095ef1e1c8ff29c3
4
+ data.tar.gz: d93c94d576010c95994e1dc861532e172457d2f4
5
5
  SHA512:
6
- metadata.gz: 68935d847520bcea700230b37f7a33c2879f7465f7119f4670810770e23f4f9f84171fc3249d004b402e3d21ade4a690ea7b51e3ff1a2aafb2b55b3722330287
7
- data.tar.gz: 10437fb26dad723be5a0bcecc94392ee2c6c09529f335fcba0c1ddd6976277133b7fe3cb0442e0a079bd7561ee82af211ae6034fcd479378f1163cbac0c65f9b
6
+ metadata.gz: b79b925ca18e2ac909e98fa09980da8c3e3768c1959dbfbd73d6d5c4d99cd4b4c2d1f6c6b4b3ad48d1bf16bb78dd934aac6fde1ac5cc5279e01475ef1ea41946
7
+ data.tar.gz: 6dde6d62db20741b824fb73fda0f328970f5937808d73d0b7cb728512294bcc0621f125082f2cee6397f23bc398ae6a2cdf5d1b2c4d69a1cbbc2db741497d882
@@ -21,11 +21,27 @@
21
21
  ➰: ","
22
22
  💭: '#'
23
23
 
24
+ # literals
25
+ 1️⃣: "1"
26
+ 2️⃣: "2"
27
+ 3️⃣: "3"
28
+ 4️⃣: "4"
29
+ 5️⃣: "5"
30
+ 6️⃣: "6"
31
+ 7️⃣: "7"
32
+ 8️⃣: "8"
33
+ 9️⃣: "9"
34
+ 0️⃣: "0"
35
+
36
+
24
37
  # conveniences
25
38
  👀: puts
26
39
  🐣: new
27
40
  💥: raise
28
- ➕: +
29
41
  🚰: tap
30
42
  📞: call
31
43
  ⚠️: warn
44
+ ➕: "+"
45
+ ➖: "-"
46
+ ➗: "/"
47
+ ✖️: "*"
@@ -24,7 +24,7 @@ module Emoruby
24
24
 
25
25
  def translate_lines(lines)
26
26
  lines.map do |line|
27
- chars = clean_chars(scan_and_translate_constants(line).chars)
27
+ chars = clean_chars(scan_and_translate_doublebyte(scan_and_translate_constants(line)).chars)
28
28
  comments = false
29
29
 
30
30
  translate_chars(chars) do |char|
@@ -37,7 +37,15 @@ module Emoruby
37
37
  end
38
38
 
39
39
  def scan_and_translate_constants(source)
40
- source.gsub(Regexp.new(constant_map.keys.map { |x| Regexp.escape(x) }.join('|')), constant_map)
40
+ find_and_replace(source, constant_map.keys, constant_map)
41
+ end
42
+
43
+ def scan_and_translate_doublebyte(source)
44
+ find_and_replace(source, EmojiData.scan(source).select(&:doublebyte?).map(&:to_s), TRANSLATIONS)
45
+ end
46
+
47
+ def find_and_replace(source, search, replacements)
48
+ source.gsub(Regexp.new(search.map {|x| Regexp.escape(x)}.join('|')), replacements)
41
49
  end
42
50
 
43
51
  def constant_map
@@ -1,3 +1,3 @@
1
1
  module Emoruby
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1 +1 @@
1
- 💭 Comment! 👋
1
+ 1️⃣ ➕ 1️⃣ 💭 Comment! 👋
@@ -1 +1 @@
1
- # Comment! 👋
1
+ 1 + 1 # Comment! 👋
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emoruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-23 00:00:00.000000000 Z
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: emoji_data