akm-selectable_attr 0.3.0 → 0.3.1

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.yml +1 -1
  2. data/lib/selectable_attr/enum.rb +2 -31
  3. metadata +3 -2
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 3
3
- :patch: 0
3
+ :patch: 1
4
4
  :major: 0
@@ -7,33 +7,12 @@ module SelectableAttr
7
7
  def instances
8
8
  @@instances ||= []
9
9
  end
10
-
11
- if defined?(I18n)
12
- def i18n_export
13
- result = {}
14
- instances.each do |instance|
15
- unless instance.i18n_scope
16
- # puts "no i18n_scope of #{instance.inspect}"
17
- next
18
- end
19
- paths = instance.i18n_scope.dup
20
- current = result
21
- paths.each do |path|
22
- current = current[path] ||= {}
23
- end
24
- instance.entries.each do |entry|
25
- current[entry.key] = entry.name
26
- end
27
- end
28
- result
29
- end
30
- end
31
10
  end
32
11
 
33
12
  def initialize(&block)
34
13
  @entries = []
35
14
  instance_eval(&block) if block_given?
36
- SelectableAttr::Enum.instances << self if defined?(I18n)
15
+ SelectableAttr::Enum.instances << self
37
16
  end
38
17
 
39
18
  def entries
@@ -148,15 +127,7 @@ module SelectableAttr
148
127
  self.instance_eval(&block) if block
149
128
  end
150
129
 
151
- if defined?(I18n)
152
- def name
153
- I18n.locale.nil? ? @name :
154
- @enum.i18n_scope.blank? ? @name :
155
- I18n.translate(key, :scope => @enum.i18n_scope, :default => @name)
156
- end
157
- else
158
- attr_reader :name
159
- end
130
+ attr_reader :name
160
131
 
161
132
  def [](option_key)
162
133
  BASE_ATTRS.include?(option_key) ? send(option_key) :
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akm-selectable_attr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takeshi Akima
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-27 00:00:00 -08:00
12
+ date: 2009-02-06 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -24,6 +24,7 @@ extra_rdoc_files: []
24
24
  files:
25
25
  - VERSION.yml
26
26
  - lib/selectable_attr
27
+ - lib/selectable_attr/#enum.rb#
27
28
  - lib/selectable_attr/base.rb
28
29
  - lib/selectable_attr/enum.rb
29
30
  - lib/selectable_attr/version.rb