derussian 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +1 -0
- data/derussian.gemspec +24 -0
- data/lib/derussian/config.yml +70 -0
- data/lib/derussian/version.rb +3 -0
- data/lib/derussian.rb +23 -0
- metadata +81 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 1158656527a8f901ab1beab2b7a79b445dc8492a
|
|
4
|
+
data.tar.gz: da41f77749005a1f9568be6b1ef01d900200df88
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 75b6cade6bcf5eee16f78973e55486873252640e5ee0e31a5a65ca590b305713320f4366dffc62e82cdb3b398f9d9adc19ef9f3a7c6064de03ffbe293e85758e
|
|
7
|
+
data.tar.gz: 8abbd9ebbe383331ddd92ef6d37dffa23b7c8675f694b053a94884d3f025571e0db0220dbdd3ed2cb80ace318abb896262aeaa57919fc60918219c1b3ce4bc5f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 Sergey Vardanyan
|
|
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,30 @@
|
|
|
1
|
+
# Derussian
|
|
2
|
+
|
|
3
|
+
Replace russian date to english
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'derussian'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install derussian
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Derussian::delocalize '13 сентября 2013'
|
|
22
|
+
Derussian::delocalize '2 часа назад'
|
|
23
|
+
|
|
24
|
+
## Contributing
|
|
25
|
+
|
|
26
|
+
1. Fork it
|
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
28
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
30
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/derussian.gemspec
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'derussian/version'
|
|
5
|
+
require 'yaml'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = "derussian"
|
|
9
|
+
spec.version = Derussian::VERSION
|
|
10
|
+
spec.authors = ["Sergey Vardanyan"]
|
|
11
|
+
spec.email = ["rakot.ss@gmail.com"]
|
|
12
|
+
spec.description = %q{Delocalize dates on russian to english one}
|
|
13
|
+
spec.summary = %q{Gem for using russian dates with Chronic gem}
|
|
14
|
+
spec.homepage = "http://rakot.ru"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files`.split($/)
|
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
20
|
+
spec.require_paths = ["lib"]
|
|
21
|
+
|
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
23
|
+
spec.add_development_dependency "rake"
|
|
24
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
replace:
|
|
2
|
+
"часа назад": "hour ago"
|
|
3
|
+
"час назад": "hour ago"
|
|
4
|
+
"полдня назад": "half day ago"
|
|
5
|
+
сегодня: today
|
|
6
|
+
вчера : yesterday
|
|
7
|
+
позавчера: "the day before yesterday"
|
|
8
|
+
"неделю назад": "week ago"
|
|
9
|
+
|
|
10
|
+
январь: January
|
|
11
|
+
января: January
|
|
12
|
+
февраль: February
|
|
13
|
+
февраля: February
|
|
14
|
+
март: March
|
|
15
|
+
марта: March
|
|
16
|
+
апрель: April
|
|
17
|
+
апреля: April
|
|
18
|
+
май: May
|
|
19
|
+
мая: May
|
|
20
|
+
июнь: June
|
|
21
|
+
июня: June
|
|
22
|
+
июль: July
|
|
23
|
+
июля: July
|
|
24
|
+
август: August
|
|
25
|
+
августа: August
|
|
26
|
+
сентябрь: September
|
|
27
|
+
сентября: September
|
|
28
|
+
октябрь: October
|
|
29
|
+
октября: October
|
|
30
|
+
ноябрь: November
|
|
31
|
+
ноября: November
|
|
32
|
+
декабрь: December
|
|
33
|
+
декабря: December
|
|
34
|
+
|
|
35
|
+
"в понедельник": "at Monday"
|
|
36
|
+
понедельника: Monday
|
|
37
|
+
понедельник: Monday
|
|
38
|
+
"во вторник": "at Tuesday"
|
|
39
|
+
вторника: Tuesday
|
|
40
|
+
вторник: Tuesday
|
|
41
|
+
"в среду": "at Wednesday"
|
|
42
|
+
среды: Wednesday
|
|
43
|
+
среда: Wednesday
|
|
44
|
+
"в четверг": "at Thursday"
|
|
45
|
+
четверга: Thursday
|
|
46
|
+
четверг: Thursday
|
|
47
|
+
"в пятницу": "at Friday"
|
|
48
|
+
пятницы: Friday
|
|
49
|
+
пятница: Friday
|
|
50
|
+
"в субботу": "at Saturday"
|
|
51
|
+
субботы: Saturday
|
|
52
|
+
суббота: Saturday
|
|
53
|
+
"в воскресенье": "at Sunday"
|
|
54
|
+
воскресенья: Sunday
|
|
55
|
+
востресенье: Sunday
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
янв: January
|
|
59
|
+
фев: February
|
|
60
|
+
мар: March
|
|
61
|
+
мрт: March
|
|
62
|
+
апр: April
|
|
63
|
+
май: May
|
|
64
|
+
июн: June
|
|
65
|
+
июл: July
|
|
66
|
+
авг: August
|
|
67
|
+
сен: September
|
|
68
|
+
окт: October
|
|
69
|
+
нбр: November
|
|
70
|
+
дек: December
|
data/lib/derussian.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "derussian/version"
|
|
2
|
+
require 'yaml'
|
|
3
|
+
|
|
4
|
+
module Derussian
|
|
5
|
+
|
|
6
|
+
extend self
|
|
7
|
+
|
|
8
|
+
@replace = YAML.load_file(File.join(File.dirname(__FILE__),'derussian/config.yml'))['replace']
|
|
9
|
+
|
|
10
|
+
def delocalize(date)
|
|
11
|
+
date = date.strip.squeeze(' ')
|
|
12
|
+
@replace.each { |needle,replacement| date = replace(date,needle,replacement) }
|
|
13
|
+
date.strip.squeeze(' ')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
protected
|
|
18
|
+
def replace(date,needle,replacement)replacement
|
|
19
|
+
date.gsub(/(\A|\s)#{needle}(\z|\s|\.)/i,' '+replacement+' ')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
metadata
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: derussian
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Sergey Vardanyan
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.3'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: Delocalize dates on russian to english one
|
|
42
|
+
email:
|
|
43
|
+
- rakot.ss@gmail.com
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- .gitignore
|
|
49
|
+
- Gemfile
|
|
50
|
+
- LICENSE.txt
|
|
51
|
+
- README.md
|
|
52
|
+
- Rakefile
|
|
53
|
+
- derussian.gemspec
|
|
54
|
+
- lib/derussian.rb
|
|
55
|
+
- lib/derussian/config.yml
|
|
56
|
+
- lib/derussian/version.rb
|
|
57
|
+
homepage: http://rakot.ru
|
|
58
|
+
licenses:
|
|
59
|
+
- MIT
|
|
60
|
+
metadata: {}
|
|
61
|
+
post_install_message:
|
|
62
|
+
rdoc_options: []
|
|
63
|
+
require_paths:
|
|
64
|
+
- lib
|
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - '>='
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - '>='
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
requirements: []
|
|
76
|
+
rubyforge_project:
|
|
77
|
+
rubygems_version: 2.0.3
|
|
78
|
+
signing_key:
|
|
79
|
+
specification_version: 4
|
|
80
|
+
summary: Gem for using russian dates with Chronic gem
|
|
81
|
+
test_files: []
|