brdata 2.1.10 → 2.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -3
- data/lib/brdata/time_portuguese.rb +16 -0
- data/lib/brdata/version.rb +1 -1
- data/test/time_test.rb +18 -0
- metadata +38 -14
data/Rakefile
CHANGED
@@ -56,7 +56,7 @@ spec = Gem::Specification.new do |s|
|
|
56
56
|
s.homepage = "http://www.improveit.com.br/software_livre/brazilian_rails"
|
57
57
|
|
58
58
|
s.add_dependency('actionpack', '>= 1.13.6')
|
59
|
-
s.add_dependency('
|
59
|
+
s.add_dependency('active_support', '>= 1.4.2')
|
60
60
|
|
61
61
|
s.has_rdoc = true
|
62
62
|
s.requirements << 'none'
|
@@ -86,7 +86,7 @@ end
|
|
86
86
|
# end
|
87
87
|
#
|
88
88
|
|
89
|
-
desc "Publish the
|
89
|
+
desc "Publish the release files to RubyForge."
|
90
90
|
task :release => [ :package ] do
|
91
|
-
|
91
|
+
`gem push pkg/#{PKG_NAME}-#{PKG_VERSION}.gem`
|
92
92
|
end
|
@@ -1,3 +1,19 @@
|
|
1
|
+
module ActiveSupport::CoreExtensions::String::Conversions
|
2
|
+
# Cria a data com horário no padrao brasileiro e permanece aceitando no formato tradicional.
|
3
|
+
#
|
4
|
+
# Exemplo:
|
5
|
+
# "27/09/2007 01:23".to_date
|
6
|
+
|
7
|
+
def to_time
|
8
|
+
if /(\d{1,2})\W(\d{1,2})\W(\d{4})(\s((\d{1,2}):(\d{2})))?/ =~ self
|
9
|
+
::Time.mktime($3.to_i, $2.to_i, $1.to_i, $6.to_i, $7.to_i)
|
10
|
+
else
|
11
|
+
::Time.parse self
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
1
17
|
class Time
|
2
18
|
alias :strftime_nolocale :strftime
|
3
19
|
|
data/lib/brdata/version.rb
CHANGED
data/test/time_test.rb
CHANGED
@@ -3,6 +3,24 @@ require File.dirname(__FILE__) + '/test_helper'
|
|
3
3
|
|
4
4
|
class TimeTest < Test::Unit::TestCase
|
5
5
|
|
6
|
+
# to_time
|
7
|
+
def test_create_time_with_traditional_time_format
|
8
|
+
assert_equal "2007-01-02 01:23:00", "2007/01/02 01:23".to_time.to_s(:db)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_create_time_with_brazilian_time_format_without_time
|
12
|
+
assert_equal "2007-12-13 00:00:00", "13/12/2007".to_time.to_s(:db)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_create_time_with_brazilian_time_format_with_time
|
16
|
+
assert_equal "2007-12-13 01:23:00", "13/12/2007 01:23".to_time.to_s(:db)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_create_time_with_brazilian_time_format_with_time_with_single_number
|
20
|
+
assert_equal "2007-02-01 01:23:00", "1/2/2007 1:23".to_time.to_s(:db)
|
21
|
+
end
|
22
|
+
|
23
|
+
|
6
24
|
#to_s
|
7
25
|
def test_time_to_s_with_traditional_format
|
8
26
|
if RUBY_VERSION < '1.9'
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 1
|
9
|
+
- 11
|
10
|
+
version: 2.1.11
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- "Marcos Tapaj\xC3\xB3s"
|
@@ -12,29 +18,41 @@ autorequire:
|
|
12
18
|
bindir: bin
|
13
19
|
cert_chain: []
|
14
20
|
|
15
|
-
date:
|
21
|
+
date: 2010-06-29 00:00:00 -03:00
|
16
22
|
default_executable:
|
17
23
|
dependencies:
|
18
24
|
- !ruby/object:Gem::Dependency
|
19
25
|
name: actionpack
|
20
|
-
|
21
|
-
|
22
|
-
|
26
|
+
prerelease: false
|
27
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
23
29
|
requirements:
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
32
|
+
hash: 47
|
33
|
+
segments:
|
34
|
+
- 1
|
35
|
+
- 13
|
36
|
+
- 6
|
26
37
|
version: 1.13.6
|
27
|
-
version:
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: activesupport
|
30
38
|
type: :runtime
|
31
|
-
|
32
|
-
|
39
|
+
version_requirements: *id001
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: active_support
|
42
|
+
prerelease: false
|
43
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
33
45
|
requirements:
|
34
46
|
- - ">="
|
35
47
|
- !ruby/object:Gem::Version
|
48
|
+
hash: 3
|
49
|
+
segments:
|
50
|
+
- 1
|
51
|
+
- 4
|
52
|
+
- 2
|
36
53
|
version: 1.4.2
|
37
|
-
|
54
|
+
type: :runtime
|
55
|
+
version_requirements: *id002
|
38
56
|
description: "brdata \xC3\xA9 uma das gems que compoem o Brazilian Rails"
|
39
57
|
email: tapajos@gmail.com
|
40
58
|
executables: []
|
@@ -74,21 +92,27 @@ rdoc_options: []
|
|
74
92
|
require_paths:
|
75
93
|
- lib
|
76
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
77
96
|
requirements:
|
78
97
|
- - ">="
|
79
98
|
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
80
102
|
version: "0"
|
81
|
-
version:
|
82
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
83
105
|
requirements:
|
84
106
|
- - ">="
|
85
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
109
|
+
segments:
|
110
|
+
- 0
|
86
111
|
version: "0"
|
87
|
-
version:
|
88
112
|
requirements:
|
89
113
|
- none
|
90
114
|
rubyforge_project: brdata
|
91
|
-
rubygems_version: 1.3.
|
115
|
+
rubygems_version: 1.3.7
|
92
116
|
signing_key:
|
93
117
|
specification_version: 3
|
94
118
|
summary: "brdata \xC3\xA9 uma das gems que compoem o Brazilian Rails"
|