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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 309d73355726d4b2e4742b8fcc9c109d463f65fc
4
- data.tar.gz: 7a9fa8413ed9556c134a448f85dee12aea35b4b8
3
+ metadata.gz: 48e087bdbc7aafdcc89ee0becdf46347e8c131af
4
+ data.tar.gz: 88b57076950b1ea351639d3c9f45f798176e8ddd
5
5
  SHA512:
6
- metadata.gz: 80eb0883fc6ba88abb93c9a7b61c4f61d5e5594dcbce6933ba8d996b7fc3037a80d64f4a32c7f10a5c1685a9abf9346db58e8af9fb7ead3dfb3b7041eafc61c9
7
- data.tar.gz: a206d5a852dc518e9a25933d4b9f1e663f59b2d5851aa0460080390430c50e9cae80b07c8ebd7a004d7f0334e92074593d43f84a07cfd90a71576855015c449b
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://githubcom/yelinaung/mmfont) gem.
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 "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
2
3
 
3
- desc "Run Tests!"
4
- task :test,[:environment] do|t,args|
5
- system "ruby spec/*_spec.rb"
6
- end
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 "Inserting middleware mmunicode"
2
- Rails.application.config.middleware.insert_before(ActionDispatch::ParamsParser,MmunicodeRails::RackMmunicode)
1
+ puts 'Inserting middleware mmunicode'
2
+ Rails.application.config.middleware.insert_before(ActionDispatch::ParamsParser,
3
+ MmunicodeRails::RackMmunicode)
@@ -1,3 +1,4 @@
1
+ # Version
1
2
  module MmunicodeRails
2
- VERSION = "0.4.5"
3
+ VERSION = '0.4.6'
3
4
  end
@@ -1,9 +1,8 @@
1
- require "mmunicode_rails/version"
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 or not utf8
197
- return nil if input_text.nil? || input_text.encoding != Encoding.find("UTF-8")
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.update_param(key, value)
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.5
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-13 00:00:00.000000000 Z
11
+ date: 2015-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler