c12-commons 0.0.1.beta3 → 0.0.1.beta4

Sign up to get free protection for your applications and to get access to all the features.
data/c12-commons.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require "c12/version"
3
+ require 'c12-commons/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "c12-commons"
@@ -34,12 +34,18 @@ module C12
34
34
  (opts[:format] == :short ? MONTHS_SHORT : MONTHS)[index - 1] if index
35
35
  end
36
36
 
37
- # Georgian number formatter.
37
+ # Format date.
38
+ def self.format_date(date, opts = {})
39
+ return nil unless date
40
+ date.strftime("%d #{month(date, opts)} %Y")
41
+ end
42
+
43
+ # Number formatter for georgian locale convensions.
38
44
  def self.number(number, opts = {})
39
45
  number_with_precision(number, :precision => opts[:precision] || 2, :delimiter => ' ', :separator => ',')
40
46
  end
41
47
 
42
- # Tokenize integer argument to georgian language.
48
+ # Tokenize integer number (in georgian).
43
49
  #
44
50
  # Example usage:
45
51
  #
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module C12
3
3
  module Commons
4
- VERSION = "0.0.1.beta3"
4
+ VERSION = "0.0.1.beta4"
5
5
  end
6
6
  end
data/lib/c12-commons.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'action_controller'
4
4
  include ActionView::Helpers::NumberHelper
5
5
 
6
- require 'c12/version'
7
- require 'c12/core'
8
- require 'c12/ka'
9
- require 'c12/pdf'
6
+ require 'c12-commons/version'
7
+ require 'c12-commons/core'
8
+ require 'c12-commons/ka'
9
+ require 'c12-commons/pdf'
@@ -84,3 +84,13 @@ test_short_month_name(11, 'ნოე')
84
84
  test_short_month_name(12, 'დეკ')
85
85
 
86
86
  test_full_month_name(nil, nil)
87
+
88
+ def test_date_format(date, expected, options = {})
89
+ describe "#{date.inspect}" do
90
+ subject { C12::KA.format_date(date, options) }
91
+ it("should be #{expected}") { should == expected }
92
+ end
93
+ end
94
+
95
+ test_date_format(Time.new(2012, 1, 1), '01 იანვარი 2012')
96
+ test_date_format(Time.new(2012, 1, 1), '01 იან 2012', :format => :short)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c12-commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.beta3
4
+ version: 0.0.1.beta4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70164365351300 !ruby/object:Gem::Requirement
16
+ requirement: &70328836491840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70164365351300
24
+ version_requirements: *70328836491840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simplecov
27
- requirement: &70164365350680 !ruby/object:Gem::Requirement
27
+ requirement: &70328836357020 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70164365350680
35
+ version_requirements: *70328836357020
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: actionpack
38
- requirement: &70164365350060 !ruby/object:Gem::Requirement
38
+ requirement: &70328836422400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70164365350060
46
+ version_requirements: *70328836422400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: prawn
49
- requirement: &70164365349560 !ruby/object:Gem::Requirement
49
+ requirement: &70328839834720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0.12'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70164365349560
57
+ version_requirements: *70328839834720
58
58
  description: Simple functionality used in my projects
59
59
  email:
60
60
  - dimitri@c12.ge
@@ -69,16 +69,16 @@ files:
69
69
  - Rakefile
70
70
  - c12-commons.gemspec
71
71
  - lib/c12-commons.rb
72
- - lib/c12/core.rb
73
- - lib/c12/ka.rb
74
- - lib/c12/pdf-assets/Arial Unicode.ttf
75
- - lib/c12/pdf-assets/DejaVuSerif-Bold.ttf
76
- - lib/c12/pdf-assets/DejaVuSerif-BoldItalic.ttf
77
- - lib/c12/pdf-assets/DejaVuSerif-Italic.ttf
78
- - lib/c12/pdf-assets/DejaVuSerif.ttf
79
- - lib/c12/pdf.rb
80
- - lib/c12/version.rb
81
- - spec/c12-commons/month_spec.rb
72
+ - lib/c12-commons/core.rb
73
+ - lib/c12-commons/ka.rb
74
+ - lib/c12-commons/pdf-assets/Arial Unicode.ttf
75
+ - lib/c12-commons/pdf-assets/DejaVuSerif-Bold.ttf
76
+ - lib/c12-commons/pdf-assets/DejaVuSerif-BoldItalic.ttf
77
+ - lib/c12-commons/pdf-assets/DejaVuSerif-Italic.ttf
78
+ - lib/c12-commons/pdf-assets/DejaVuSerif.ttf
79
+ - lib/c12-commons/pdf.rb
80
+ - lib/c12-commons/version.rb
81
+ - spec/c12-commons/date_spec.rb
82
82
  - spec/c12-commons/number_spec.rb
83
83
  - spec/c12-commons/pdf_spec.rb
84
84
  - spec/c12-commons/ruby_spec.rb
@@ -108,7 +108,7 @@ signing_key:
108
108
  specification_version: 3
109
109
  summary: Simple functions
110
110
  test_files:
111
- - spec/c12-commons/month_spec.rb
111
+ - spec/c12-commons/date_spec.rb
112
112
  - spec/c12-commons/number_spec.rb
113
113
  - spec/c12-commons/pdf_spec.rb
114
114
  - spec/c12-commons/ruby_spec.rb
File without changes
File without changes