enumerate_it 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1558c3ef8bfaf0bfe9ec496af98f6fd794b04dde
4
- data.tar.gz: bf56fe8d302929046e3acb21d246fe3a25745bdc
3
+ metadata.gz: 9ad333269f935566eb9da374a8ea85983503241c
4
+ data.tar.gz: 854d42aea0246c5a71975b440afe2bff426b14f3
5
5
  SHA512:
6
- metadata.gz: a39df4cbd269760cbbd1b0d7dc0176c49253f781fa587202307dacc56d3c020c6e37e02b447ec179fb64857df39f9d75d31cb6642d395ab34a6ef5eb1ad03b49
7
- data.tar.gz: 43d0aab4b4753bdd6af81131f57b4e1ca766f3ee48182c20ff8513b5c4c6d24a051787420ec499e9eddadbda66cb6e5ffa052c0036695d07cc7b074af00efd2e
6
+ metadata.gz: 99c994cb23ba95457d4f1838be1c8f87e4a19b0c80316bf520a1489c11756556e114c8ac55a78b4a8025534cc674c5356fc30f9f5d1e4431f40b27a5c9a6676c
7
+ data.tar.gz: 4947235c8dc943e21af7100b5a048247f878bd274249731eaa84aadf68c2b3d294ae6e0d0936f7e415cb352142650db1229b816726c1dd51f6854941b1d3e524
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enumerate_it (1.6.0)
4
+ enumerate_it (1.6.1)
5
5
  activesupport (>= 3.0.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module EnumerateIt
2
- VERSION = '1.6.0'.freeze
2
+ VERSION = '1.6.1'.freeze
3
3
  end
@@ -3,7 +3,7 @@ module EnumerateIt
3
3
  class EnumGenerator < Rails::Generators::NamedBase
4
4
  source_root File.expand_path('../templates', __FILE__)
5
5
 
6
- argument :attributes, type: 'array', default: []
6
+ argument :attributes, type: 'array'
7
7
 
8
8
  class_option :singular, type: 'string', desc: 'Singular name for i18n'
9
9
 
@@ -14,12 +14,12 @@ module EnumerateIt
14
14
  template 'locale.yml', File.join('config/locales', "#{singular_name}.yml")
15
15
  end
16
16
 
17
- desc 'Creates an initializer file that extends ActiveRecord::Base with Enumerate_it'
17
+ desc 'Creates the enumeration'
18
18
  def create_enumerate_it
19
19
  template 'enumerate_it.rb', File.join('app/enumerations', "#{singular_name}.rb")
20
20
  end
21
21
 
22
- protected
22
+ private
23
23
 
24
24
  def default_lang
25
25
  options[:lang]
@@ -1,3 +1,5 @@
1
1
  class <%= class_name %> < EnumerateIt::Base
2
- <% if fields.first.is_a?(Array) %>associate_values <%= fields.map {|field, value| ":#{field} => #{value}"}.join(', ') %><% else %>associate_values <%= fields.map {|field| ":#{field}"}.join(', ') %><% end %>
2
+ associate_values(
3
+ <%= fields.map { |field, value| value ? "#{field}: #{value}" : ":#{field}"}.join(",\n ") %>
4
+ )
3
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cássio Marques