easy_globalize3_accessors 1.3.1 → 1.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36c0905e4dcde52f174478b059cac112e56b4ec9
4
- data.tar.gz: b4211b3a6b4e4e4c222bd74ea191519b56da171f
3
+ metadata.gz: b49ff457d87efa7ad5b7ea6969fb7b1b4f97f405
4
+ data.tar.gz: eacab7e85cda683a24606a64d3d6c77e75e7f353
5
5
  SHA512:
6
- metadata.gz: d595df8d400dc9d6b1ed4941cb11510b0823e407ffcf179aa815c936884d66590a83768fb41b54bf5fce1cadc8281ee031715d7dcbb1e1d2ec6b8a7ebe1e0075
7
- data.tar.gz: b17be90e4b2c891e9101c70f7810a26ba4b2470b77c23078d0743a1771b499e3e93297565168be942e66e2fbe1e7a6b0dded5016e1c560c07f5c55dcdbea5d17
6
+ metadata.gz: c3a54024a939bf01302cbd4fd54f7fb05b9803224ae2b2d97c39ddef0a2d6df515778cd2f64e43dd2e5097877f52fbf9b795a96c19e0fa96e287abeb41fde79d
7
+ data.tar.gz: 04f0cbf82a79972fa220dc3a6264f905985bb1ce21bb10163d0ed5f9dc241a27360751c5103ce42f11d5447ea3bb67dab775ab90f1bc245d076a6800291e6dbf
data/README.rdoc CHANGED
@@ -28,7 +28,10 @@ Gives you access to methods: title_pl, title_en, title_pl=, title_en= (and simil
28
28
  :locales => I18n.available_locales
29
29
  :attributes => translated_attribute_names
30
30
 
31
- which means that skipping all options will generate you accessor method for all translated fields and available languages
31
+ which means that skipping all options will generate you accessor method for all translated fields and available languages.
32
+
33
+ You can also get locales for class with "globalize_locales" method:
34
+ Product.globalize_locales # => [:en, :pl]
32
35
 
33
36
  == Always define accessors
34
37
 
@@ -1,9 +1,11 @@
1
1
  require 'globalize3'
2
2
 
3
3
  module EasyGlobalize3Accessors
4
+ attr_reader :globalize_locales
4
5
 
5
6
  def globalize_accessors(options = {})
6
7
  options.reverse_merge!(:locales => I18n.available_locales, :attributes => translated_attribute_names)
8
+ @globalize_locales = options[:locales]
7
9
 
8
10
  each_attribute_and_locale(options) do |attr_name, locale|
9
11
  define_accessors(attr_name, locale)
@@ -1,3 +1,3 @@
1
1
  module EasyGlobalize3Accessors
2
- VERSION = '1.3.1'
2
+ VERSION = '1.3.2'
3
3
  end
@@ -100,4 +100,11 @@ class EasyGlobalizeAccessorsTest < ActiveSupport::TestCase
100
100
  assert_nil u.title_pl
101
101
  end
102
102
 
103
+ test "globalize locales on class without locales specified in options" do
104
+ assert_equal [:en, :pl], Unit.globalize_locales
105
+ end
106
+
107
+ test "globalize locales on class with locales specified in options" do
108
+ assert_equal [:pl], UnitTranslatedWithOptions.globalize_locales
109
+ end
103
110
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_globalize3_accessors
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Stachewicz
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-08-19 00:00:00.000000000 Z
14
+ date: 2013-08-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: globalize3
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: 1.3.6
111
111
  requirements: []
112
112
  rubyforge_project: easy_globalize3_accessors
113
- rubygems_version: 2.0.3
113
+ rubygems_version: 2.0.5
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Define methods for accessing translated attributes