galakei 0.2.0 → 0.3.0

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.
data/lib/galakei.rb CHANGED
@@ -9,6 +9,7 @@ module Galakei
9
9
  autoload :Email, "galakei/email"
10
10
  autoload :HelperMethods, "galakei/helper_methods"
11
11
  autoload :InputMode, "galakei/input_mode"
12
+ autoload :EmojiTable, "galakei/emoji_table"
12
13
  module Filter
13
14
  autoload :Base, "galakei/filter/base"
14
15
  autoload :ContentType, "galakei/filter/content_type"
@@ -0,0 +1,44 @@
1
+ module Galakei
2
+ class EmojiTable
3
+ MAPPING = {
4
+ :black_sun_with_rays => %w[2600 E63E E488 E04A],
5
+ :cloud => %w[2601 E63F E48D E049],
6
+ :black_telephon => %w[260E E687 E596 E009],
7
+ :white_smiling_face => %w[263A E6F0 E4FB E414],
8
+ :left_pointing_magnifying_glass => %w[1F50D E6DC E518 E114],
9
+ :envelope => %w[2709 E6D3 E521 E103],
10
+ :footprints => %w[1F463 E698 EB2A E536],
11
+ :pencil => %w[270F E719 E4A1 E301],
12
+ :key => %w[1F511 E6D9 E519 E03F],
13
+ :alarm_clock => %w[23F0 E6BA E594 E02D],
14
+ :four_leaf_clover => %w[1F340 E741 E513 E110],
15
+ :warning_sign => %w[26A0 E737 E481 E252],
16
+ }
17
+ MAPPING.each do |k,v|
18
+ MAPPING[k] = v.map {|s| "&#x#{s};".html_safe}
19
+ define_method k do
20
+ MAPPING[k][@carrier]
21
+ end
22
+ end
23
+
24
+ def initialize(i)
25
+ @carrier = i
26
+ end
27
+
28
+ def self.unicode
29
+ @unicode ||= EmojiTable.new(0)
30
+ end
31
+
32
+ def self.docomo
33
+ @docomo ||= EmojiTable.new(1)
34
+ end
35
+
36
+ def self.au
37
+ @au ||= EmojiTable.new(2)
38
+ end
39
+
40
+ def self.softbank
41
+ @softbank ||= EmojiTable.new(3)
42
+ end
43
+ end
44
+ end
@@ -2,6 +2,7 @@ module Galakei
2
2
  module HelperMethods
3
3
  def self.included(klass)
4
4
  klass.helper_method :galakei?
5
+ klass.helper_method :emoji_table
5
6
  end
6
7
 
7
8
  protected
@@ -9,5 +10,17 @@ module Galakei
9
10
  def galakei?
10
11
  request.galakei?
11
12
  end
13
+
14
+ def emoji_table
15
+ if request.docomo?
16
+ EmojiTable.docomo
17
+ elsif request.softbank?
18
+ EmojiTable.softbank
19
+ elsif request.au?
20
+ EmojiTable.au
21
+ else
22
+ EmojiTable.unicode
23
+ end
24
+ end
12
25
  end
13
26
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Paul McMahon
@@ -75,6 +75,7 @@ files:
75
75
  - LICENSE
76
76
  - README.md
77
77
  - lib/galakei/email.rb
78
+ - lib/galakei/emoji_table.rb
78
79
  - lib/galakei/filter/base.rb
79
80
  - lib/galakei/filter/content_type.rb
80
81
  - lib/galakei/filter/haml.rb