to_bn 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in to_bn.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jasthi Nagadeva
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # to_bn
2
+
3
+ Ruby Gem to convert number and date from English to Bengali.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'to_bn'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install to_bn
18
+
19
+ ## Usage
20
+
21
+ Converting Number/String
22
+
23
+ 123.to_bn # => "১২৩"
24
+ 123.456.to_bn # => "১২৩.৪৫৬"
25
+ "123 to 456".to_bn # => "১২৩ to ৪৫৬"
26
+
27
+ Converting String (Containing Date)
28
+
29
+ "Mon, 09 Sep 2013".to_bn :parse_date => true # => "সোম, ০৯ সেপ্টেম্বর ২০১৩"
30
+ "Friday".to_bn :parse_date => true # => "শুক্রবার"
31
+ "Fri".to_bn :parse_date => true # => "শুক্র"
32
+ "Boishakh 1432".to_bn :parse_date => true # => "বৈশাখ ১৪৩২"
33
+
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module ToBn
2
+ VERSION = "1.0.0"
3
+ end
data/lib/to_bn.rb ADDED
@@ -0,0 +1,82 @@
1
+ # encoding: utf-8
2
+
3
+ require "to_bn/version"
4
+
5
+ class String
6
+ def to_bn(params = {:parse_date => false})
7
+ unless params[:parse_date] == true
8
+ return gsub(/[1234567890]/, '1'=>'১', '2'=>'২', '3'=>'৩', '4'=>'৪', '5'=>'৫', '6'=>'৬', '7'=>'৭', '8'=>'৮', '9'=>'৯', '0'=>'০')
9
+ else
10
+ date = to_bn
11
+ date.gsub!('January', 'জানুয়ারী')
12
+ date.gsub!('February', 'ফেব্রুয়ারী')
13
+ date.gsub!('March', 'মার্চ')
14
+ date.gsub!('April', 'এপ্রিল')
15
+ date.gsub!('May', 'মে')
16
+ date.gsub!('June', 'জুন')
17
+ date.gsub!('July', 'জুলাই')
18
+ date.gsub!('August', 'অগাষ্ট')
19
+ date.gsub!('September', 'সেপ্টেম্বর')
20
+ date.gsub!('October', 'অক্টোবর')
21
+ date.gsub!('November', 'নভেম্বর')
22
+ date.gsub!('December', 'ডিসেম্বর')
23
+
24
+ date.gsub!('Jan', 'জানুয়ারী')
25
+ date.gsub!('Feb', 'ফেব্রুয়ারী')
26
+ date.gsub!('Mar', 'মার্চ')
27
+ date.gsub!('Apr', 'এপ্রিল')
28
+ date.gsub!('May', 'মে')
29
+ date.gsub!('Jun', 'জুন')
30
+ date.gsub!('Jul', 'জুলাই')
31
+ date.gsub!('Aug', 'অগাষ্ট')
32
+ date.gsub!('Sep', 'সেপ্টেম্বর')
33
+ date.gsub!('Oct', 'অক্টোবর')
34
+ date.gsub!('Nov', 'নভেম্বর')
35
+ date.gsub!('Dec', 'ডিসেম্বর')
36
+
37
+ date.gsub!('Saturday', 'শনিবার')
38
+ date.gsub!('Sunday', 'রবিবার')
39
+ date.gsub!('Monday', 'সোমবার')
40
+ date.gsub!('Tuesday', 'মঙ্গলবার')
41
+ date.gsub!('Wednesday', 'বুধবার')
42
+ date.gsub!('Thursday', 'বৃহস্পতিবার')
43
+ date.gsub!('Friday', 'শুক্রবার')
44
+
45
+ date.gsub!('Sat', 'শনি')
46
+ date.gsub!('Sun', 'রবি')
47
+ date.gsub!('Mon', 'সোম')
48
+ date.gsub!('Tues', 'মঙ্গল')
49
+ date.gsub!('Tue', 'মঙ্গল')
50
+ date.gsub!('Wed', 'বুধ')
51
+ date.gsub!('Thurs', 'বৃহস্পতি')
52
+ date.gsub!('Thu', 'বৃহস্পতি')
53
+ date.gsub!('Fri', 'শুক্র')
54
+
55
+ date.gsub!('Boishakh', 'বৈশাখ')
56
+ date.gsub!('Joishtho', 'জ্যৈষ্ঠ')
57
+ date.gsub!('Ashar', 'আষাঢ়')
58
+ date.gsub!('Srabon', 'শ্রাবণ')
59
+ date.gsub!('Bhadro', 'ভাদ্র')
60
+ date.gsub!('Ashin', 'আশ্বিন')
61
+ date.gsub!('Kartrik','কার্তিক')
62
+ date.gsub!('Agrohayon','অগ্রহায়ণ')
63
+ date.gsub!('Poush', 'পৌষ')
64
+ date.gsub!('Magh', 'মাঘ')
65
+ date.gsub!('Falgun', 'ফাল্গুন ')
66
+ date.gsub('Chaitro', 'চৈত্র')
67
+ end
68
+ end
69
+ end
70
+
71
+ class Integer < Numeric
72
+ def to_bn
73
+ self.to_s.to_bn
74
+ end
75
+ end
76
+
77
+ class Float < Numeric
78
+ def to_bn
79
+ self.to_s.to_bn
80
+ end
81
+ end
82
+
data/to_bn.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'to_bn/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "to_bn"
8
+ spec.version = ToBn::VERSION
9
+ spec.authors = ['Ali Hasan Imam']
10
+ spec.email = ['imam.aiub@gmail.com']
11
+ spec.description = %q{Ruby Gem to convert number and date from English to Bengali.}
12
+ spec.summary = %q{Bengali Conversion}
13
+ spec.homepage = 'https://github.com/codedefine/to_bn.git'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: to_bn
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ali Hasan Imam
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-09-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Ruby Gem to convert number and date from English to Bengali.
47
+ email:
48
+ - imam.aiub@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - lib/to_bn.rb
59
+ - lib/to_bn/version.rb
60
+ - to_bn.gemspec
61
+ homepage: https://github.com/codedefine/to_bn.git
62
+ licenses:
63
+ - MIT
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ segments:
75
+ - 0
76
+ hash: 2418807504506722400
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ segments:
84
+ - 0
85
+ hash: 2418807504506722400
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 1.8.25
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Bengali Conversion
92
+ test_files: []