l10n 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/l10n/column_translation.rb +5 -7
  3. metadata +16 -17
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -3,15 +3,13 @@ module L10n
3
3
 
4
4
  def self.included(base)
5
5
  base.extend ClassMethods
6
- base.class_attribute :translated_attributes, :translation_options
6
+ base.class_attribute :translated_attributes
7
7
  base.translated_attributes = []
8
- base.translation_options = {}
9
8
  end
10
9
 
11
10
  module ClassMethods
12
11
  def translates(*attrs)
13
- self.translation_options = attrs.last.is_a?(Hash) ? attrs.pop : {}
14
- self.translated_attributes = attrs
12
+ self.translated_attributes = (translated_attributes + attrs).map(&:to_sym).uniq
15
13
 
16
14
  definition_context = Proc.new do |attr_name|
17
15
  define_method "#{attr_name}_t" do
@@ -58,9 +56,9 @@ module L10n
58
56
  end
59
57
 
60
58
  def translate_column_name(column_name_t)
61
- column_name_t = column_name_t.to_s
62
- if column_name_t.ends_with?('_t') and translates?(column_name_t[0..-3])
63
- "#{column_name_t[0..-3]}#{I18n.translation_suffix}"
59
+ name = column_name_t.to_s
60
+ if name.ends_with?('_t') and translates?(name[0..-3])
61
+ "#{name[0..-3]}#{I18n.translation_suffix}".to_sym
64
62
  else
65
63
  column_name_t
66
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: l10n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-28 00:00:00.000000000 Z
12
+ date: 2012-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
- requirement: &3672640 !ruby/object:Gem::Requirement
16
+ requirement: &2151919420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *3672640
24
+ version_requirements: *2151919420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
27
- requirement: &3672400 !ruby/object:Gem::Requirement
27
+ requirement: &2151918880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *3672400
35
+ version_requirements: *2151918880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: activesupport
38
- requirement: &3672170 !ruby/object:Gem::Requirement
38
+ requirement: &2151918160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 3.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *3672170
46
+ version_requirements: *2151918160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: actionpack
49
- requirement: &3671940 !ruby/object:Gem::Requirement
49
+ requirement: &2151917520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.0.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *3671940
57
+ version_requirements: *2151917520
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sqlite3
60
- requirement: &3671750 !ruby/object:Gem::Requirement
60
+ requirement: &2151917000 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *3671750
68
+ version_requirements: *2151917000
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &3671520 !ruby/object:Gem::Requirement
71
+ requirement: &2151916300 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *3671520
79
+ version_requirements: *2151916300
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rake
82
- requirement: &3671270 !ruby/object:Gem::Requirement
82
+ requirement: &2151915400 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 0.8.7
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *3671270
90
+ version_requirements: *2151915400
91
91
  description: I18n that roarrrs
92
92
  email: mtgrosser@gmx.net
93
93
  executables: []
@@ -135,4 +135,3 @@ signing_key:
135
135
  specification_version: 3
136
136
  summary: Extensions for Rails I18n
137
137
  test_files: []
138
- has_rdoc: