mmunicode_rails 0.4.5 → 0.4.6
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/README.md +1 -1
- data/Rakefile +10 -5
- data/lib/generators/mmunicode_rails/initializer_generator.rb +3 -4
- data/lib/generators/templates/mmunicode_rails.rb +3 -2
- data/lib/mmunicode_rails/version.rb +2 -1
- data/lib/mmunicode_rails.rb +15 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48e087bdbc7aafdcc89ee0becdf46347e8c131af
|
4
|
+
data.tar.gz: 88b57076950b1ea351639d3c9f45f798176e8ddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fae6d77b0da81f7bd0397ea377905f9f712d7fc63f0f148e0661e922b1f803f5a8ce66273cc519797aa6e5524dbb402be122685754dab950c6c0a64f92c08ab
|
7
|
+
data.tar.gz: 39d7907eaf0e100e1de99ac5c3a52ec056784a3f5d303a2840bc4ddb800cc0fe411d180a7848faa739343c4c91487dddb128039bb229fc8be589f645c84a87e6
|
data/README.md
CHANGED
@@ -112,7 +112,7 @@ If you would like to contribute then
|
|
112
112
|
|
113
113
|
## Credits
|
114
114
|
|
115
|
-
- [Ye Lin Aung](https://github.com/yelinaung) for his awesome [mmfont](https://
|
115
|
+
- [Ye Lin Aung](https://github.com/yelinaung) for his awesome [mmfont](https://github.com/yelinaung/mmfont) gem.
|
116
116
|
|
117
117
|
- [Thura Hlaing](https://github.com/trhura) for his excellent [paytan](https://github.com/trhura/paytan) converter generator.
|
118
118
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
2
3
|
|
3
|
-
desc
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
desc 'Run Tests!'
|
5
|
+
Rake::TestTask.new do |t|
|
6
|
+
t.libs << 'lib'
|
7
|
+
t.libs << 'spec'
|
8
|
+
system 'ruby spec/*_spec.rb'
|
9
|
+
end
|
10
|
+
|
11
|
+
task default: :test
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module MmunicodeRails
|
2
2
|
module Generators
|
3
|
+
# Generator
|
3
4
|
class InitializerGenerator < ::Rails::Generators::Base
|
4
|
-
|
5
|
-
source_root File.expand_path("../../templates", __FILE__)
|
5
|
+
source_root File.expand_path('../../templates', __FILE__)
|
6
6
|
|
7
7
|
desc 'Creates MmunicodeRails initializer.'
|
8
8
|
|
9
9
|
def copy_initializer
|
10
10
|
copy_file 'mmunicode_rails.rb', 'config/initializers/mmunicode_rails.rb'
|
11
11
|
end
|
12
|
-
|
13
12
|
end
|
14
13
|
end
|
15
|
-
end
|
14
|
+
end
|
@@ -1,2 +1,3 @@
|
|
1
|
-
puts
|
2
|
-
Rails.application.config.middleware.insert_before(ActionDispatch::ParamsParser,
|
1
|
+
puts 'Inserting middleware mmunicode'
|
2
|
+
Rails.application.config.middleware.insert_before(ActionDispatch::ParamsParser,
|
3
|
+
MmunicodeRails::RackMmunicode)
|
data/lib/mmunicode_rails.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require 'mmunicode_rails/version'
|
2
2
|
require 'rack'
|
3
3
|
|
4
4
|
module MmunicodeRails
|
5
|
-
|
6
|
-
module Core
|
5
|
+
module Core
|
7
6
|
def uni512zg1(input_text)
|
8
7
|
return input_text unless detect_font(input_text) == :uni
|
9
8
|
output_text = input_text
|
@@ -193,8 +192,10 @@ module MmunicodeRails
|
|
193
192
|
end
|
194
193
|
|
195
194
|
def detect_font(input_text)
|
196
|
-
#do nothing if nil text
|
197
|
-
return nil if input_text.nil?
|
195
|
+
#do nothing if nil text
|
196
|
+
return nil if input_text.nil?
|
197
|
+
#force encode every string to utf-8 , will raise error if incompabtible
|
198
|
+
input_text = input_text.force_encoding("UTF-8")
|
198
199
|
whitespace = "[\s\t\n]"
|
199
200
|
priorities = {zawgyi: 2, uni: 1, eng: 3}
|
200
201
|
#Font Detecting Library
|
@@ -321,7 +322,7 @@ module MmunicodeRails
|
|
321
322
|
|
322
323
|
converted_params.each_pair do|key,value|
|
323
324
|
puts "#{key}: #{value}"
|
324
|
-
request.
|
325
|
+
request.params[key] = value
|
325
326
|
end
|
326
327
|
@app.call(env)
|
327
328
|
end
|
@@ -344,5 +345,13 @@ module MmunicodeRails
|
|
344
345
|
end
|
345
346
|
end
|
346
347
|
|
348
|
+
f = "ေဇာ္ဂ်ီေခတ္ကြ"
|
349
|
+
class A
|
350
|
+
include MmunicodeRails::Core
|
351
|
+
end
|
352
|
+
|
353
|
+
a = A.new
|
354
|
+
puts a.detect_font(f).class
|
355
|
+
|
347
356
|
|
348
357
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmunicode_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dreamingblackcat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|