emoruby 0.0.1 โ 0.0.2
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 +4 -4
- data/config/translations.yml +19 -0
- data/lib/emoruby/converts_emoji_to_ruby.rb +5 -9
- data/lib/emoruby/version.rb +1 -1
- data/spec/1_hello_world_spec.rb +2 -6
- data/spec/2_module_with_addition_spec.rb +5 -0
- data/spec/fixtures/2_module_with_addition.emoruby +5 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/support/file_helpers.rb +7 -0
- metadata +10 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8437f52585aa5e235a4aeabc77778b7aecada629
|
|
4
|
+
data.tar.gz: a5888ca7dea71281b22813af3141e8173e3ea557
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7dcae6112ec5222f8eadf02b63b01a12a00b5f2a0862ba0d9c3d0bd44057050c1e34d51e31dcf3666da57db2dc1e95b25ab5748551f9c8939850effd9ad67fc6
|
|
7
|
+
data.tar.gz: c88caca36a2681bbc062ace60cca8a5a13106e9ae0da4c5bb2bc1b780be578cef44197c04b685daa222152f2bf33613ca2f7387624373b363f42d8e15f35d012
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
require 'emoji_data'
|
|
2
2
|
require 'emoruby/util/string'
|
|
3
3
|
|
|
4
|
+
require 'yaml'
|
|
5
|
+
require 'pathname'
|
|
6
|
+
|
|
4
7
|
module Emoruby
|
|
5
8
|
class ConvertsEmojiToRuby
|
|
6
|
-
TRANSLATIONS =
|
|
7
|
-
"clipboard" => "class",
|
|
8
|
-
"soon" => "def",
|
|
9
|
-
"eyes" => "puts",
|
|
10
|
-
"speech_balloon" => "\"",
|
|
11
|
-
"black_small_square" => ".",
|
|
12
|
-
"hatching_chick" => "new"
|
|
13
|
-
}
|
|
9
|
+
TRANSLATIONS = YAML.load(File.read(Pathname.new(File.dirname(__FILE__)).join("..","..","config","translations.yml")))
|
|
14
10
|
|
|
15
11
|
GARBAGE = [
|
|
16
12
|
[239,184,143] # evil problematic whitespace where is it from where am i what even
|
|
@@ -38,7 +34,7 @@ module Emoruby
|
|
|
38
34
|
|
|
39
35
|
def emoji_name_for(char)
|
|
40
36
|
return unless emoji = EmojiData.find_by_str(char).first
|
|
41
|
-
TRANSLATIONS[emoji.
|
|
37
|
+
TRANSLATIONS[emoji.to_s] || emoji.short_name
|
|
42
38
|
end
|
|
43
39
|
|
|
44
40
|
def clean_chars(source)
|
data/lib/emoruby/version.rb
CHANGED
data/spec/1_hello_world_spec.rb
CHANGED
|
@@ -3,13 +3,9 @@ require 'spec_helper'
|
|
|
3
3
|
require 'emoruby'
|
|
4
4
|
|
|
5
5
|
describe Emoruby do
|
|
6
|
-
Given(:emo_path) { Pathname.pwd.join("spec","fixtures","#{file_name}.emoruby") }
|
|
7
|
-
Given(:emo_source) { File.read(emo_path) }
|
|
8
|
-
Given(:expected_ruby_path) { Pathname.pwd.join("spec","fixtures","#{file_name}.rb") }
|
|
9
|
-
Given(:expected_ruby) { File.read(expected_ruby_path) }
|
|
10
|
-
|
|
11
6
|
context "a hello world app" do
|
|
12
|
-
Given(:
|
|
7
|
+
Given(:emo_source) { load_fixture("1_hello_world") }
|
|
8
|
+
Given(:expected_ruby) { load_fixture("1_hello_world","rb") }
|
|
13
9
|
|
|
14
10
|
describe 'translating source' do
|
|
15
11
|
When(:result) { Emoruby.emoji_to_ruby(emo_source) }
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'rspec/given'
|
|
2
|
+
require 'support/file_helpers'
|
|
2
3
|
|
|
3
4
|
RSpec::Matchers.define :match_all_the_characters_of do |expected|
|
|
4
5
|
match do |actual|
|
|
@@ -14,5 +15,9 @@ RSpec::Matchers.define :match_all_the_characters_of do |expected|
|
|
|
14
15
|
end
|
|
15
16
|
end
|
|
16
17
|
|
|
18
|
+
RSpec.configure do |c|
|
|
19
|
+
c.include FileHelpers
|
|
20
|
+
end
|
|
21
|
+
|
|
17
22
|
# other junk
|
|
18
23
|
require 'pry'
|
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.0.
|
|
4
|
+
version: 0.0.2
|
|
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-
|
|
11
|
+
date: 2014-11-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: emoji_data
|
|
@@ -124,6 +124,7 @@ files:
|
|
|
124
124
|
- README.md
|
|
125
125
|
- Rakefile
|
|
126
126
|
- bin/emoruby
|
|
127
|
+
- config/translations.yml
|
|
127
128
|
- emoruby.gemspec
|
|
128
129
|
- lib/emoruby.rb
|
|
129
130
|
- lib/emoruby/converts_emoji_to_ruby.rb
|
|
@@ -132,9 +133,12 @@ files:
|
|
|
132
133
|
- lib/emoruby/util/string.rb
|
|
133
134
|
- lib/emoruby/version.rb
|
|
134
135
|
- spec/1_hello_world_spec.rb
|
|
136
|
+
- spec/2_module_with_addition_spec.rb
|
|
135
137
|
- spec/fixtures/1_hello_world.emoruby
|
|
136
138
|
- spec/fixtures/1_hello_world.rb
|
|
139
|
+
- spec/fixtures/2_module_with_addition.emoruby
|
|
137
140
|
- spec/spec_helper.rb
|
|
141
|
+
- spec/support/file_helpers.rb
|
|
138
142
|
homepage: https://github.com/searls/emoruby
|
|
139
143
|
licenses:
|
|
140
144
|
- MIT
|
|
@@ -155,12 +159,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
155
159
|
version: '0'
|
|
156
160
|
requirements: []
|
|
157
161
|
rubyforge_project:
|
|
158
|
-
rubygems_version: 2.
|
|
162
|
+
rubygems_version: 2.4.4
|
|
159
163
|
signing_key:
|
|
160
164
|
specification_version: 4
|
|
161
165
|
summary: A little emoji language that compiles down to Ruby
|
|
162
166
|
test_files:
|
|
163
167
|
- spec/1_hello_world_spec.rb
|
|
168
|
+
- spec/2_module_with_addition_spec.rb
|
|
164
169
|
- spec/fixtures/1_hello_world.emoruby
|
|
165
170
|
- spec/fixtures/1_hello_world.rb
|
|
171
|
+
- spec/fixtures/2_module_with_addition.emoruby
|
|
166
172
|
- spec/spec_helper.rb
|
|
173
|
+
- spec/support/file_helpers.rb
|