simple_helpers 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.0.3
2
+
3
+ * Automatic pluralize I18n scope names is no longer the default behavior
4
+
1
5
  ## v0.0.2
2
6
 
3
7
  * Patch for "#{name}_options" instance_variable_set
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/vitormil/simple_helpers)
3
3
  [![Build Status](https://secure.travis-ci.org/vitormil/simple_helpers.png)](http://travis-ci.org/vitormil/simple_helpers)
4
4
 
5
- Easily create variables with I18n and interpolation support to your controllers and views.
5
+ Easily create helper methods with I18n and interpolation support to your controllers and views.
6
6
 
7
7
  You can configure it to automaticly create some methods (like page_title, page_subtitle) or call the method **simple_helper** manually according to your needs.
8
8
 
@@ -20,9 +20,9 @@ You can configure an automatic behavior to your controllers setting an initializ
20
20
  require "simple_helpers"
21
21
 
22
22
  SimpleHelpers.configure do |config|
23
- config.helpers = [:page_title]
24
- config.blacklist = [SessionsController]
25
- config.whitelist = []
23
+ config.helpers = [:page_title]
24
+ config.except = [SessionsController]
25
+ config.only = []
26
26
  end
27
27
  ```
28
28
 
@@ -63,7 +63,7 @@ en:
63
63
 
64
64
  ### Interpolation
65
65
 
66
- In many cases you want to abstract your translations so that variables can be interpolated into the translation, just like Rails do.
66
+ In many cases you want to abstract your translations so that variables can be interpolated into the translation, just like Rails does.
67
67
 
68
68
  ```ruby
69
69
  page_title :name => @user.name
@@ -83,7 +83,7 @@ There are some action aliases:
83
83
  "remove" => "destroy"
84
84
  ```
85
85
 
86
- I18n Backend Chain:
86
+ I18n backend chain:
87
87
 
88
88
  ```ruby
89
89
  en:
@@ -116,7 +116,7 @@ end
116
116
 
117
117
  This means that the I18n scope for the action "the_custom_action" will be the same as "index".
118
118
 
119
- You can also specify a custom location at the "scope" key at the options hash, like rails does.
119
+ You can also specify a custom location at the "scope" key at the options hash, exactly like Rails does.
120
120
 
121
121
  ```ruby
122
122
  simple_helper :page_title, :scope => "my.awesome.chain", :name => "John"
@@ -1,22 +1,22 @@
1
1
  module SimpleHelpers
2
2
  class Config
3
3
 
4
- VALID_OPTIONS = [:log]
4
+ VALID_OPTIONS = [:log, :pluralize]
5
5
 
6
- def self.whitelist
7
- @whitelist ||= []
6
+ def self.only
7
+ @only ||= []
8
8
  end
9
9
 
10
- def self.whitelist=(*allowed)
11
- @whitelist = SimpleHelpers::Support.certified_array!(allowed)
10
+ def self.only=(*allowed)
11
+ @only = SimpleHelpers::Support.certified_array!(allowed)
12
12
  end
13
13
 
14
- def self.blacklist
15
- @blacklist ||= []
14
+ def self.except
15
+ @except ||= []
16
16
  end
17
17
 
18
- def self.blacklist=(*not_allowed)
19
- @blacklist = SimpleHelpers::Support.certified_array!(not_allowed)
18
+ def self.except=(*not_allowed)
19
+ @except = SimpleHelpers::Support.certified_array!(not_allowed)
20
20
  end
21
21
 
22
22
  def self.helpers
@@ -28,9 +28,9 @@ module SimpleHelpers
28
28
  end
29
29
 
30
30
  def self.allowed_controller?(controller)
31
- ( @whitelist.empty? and @blacklist.empty? ) or
32
- ( not @whitelist.empty? and @whitelist.include?(controller) ) or
33
- ( not @blacklist.empty? and not @blacklist.include?(controller) )
31
+ ( @only.empty? and @except.empty? ) or
32
+ ( not @only.empty? and @only.include?(controller) ) or
33
+ ( not @except.empty? and not @except.include?(controller) )
34
34
  end
35
35
 
36
36
  def self.options
@@ -24,6 +24,7 @@ module SimpleHelpers
24
24
  simple_helper_aliases = controller.class.const_get :SIMPLE_HELPER_ALIASES
25
25
  action_name = simple_helper_aliases.fetch(action_name, action_name) if simple_helper_aliases.is_a? Hash
26
26
  end
27
+ group = method_name
27
28
  group = group.pluralize if options.has_key? :pluralize
28
29
 
29
30
  {
@@ -2,7 +2,7 @@ module SimpleHelpers
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 3
5
+ PATCH = 4
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -11,8 +11,8 @@ module SimpleHelpers
11
11
  end
12
12
 
13
13
  SimpleHelpers.configure do |config|
14
- config.helpers = []
15
- config.whitelist = []
16
- config.blacklist = []
17
- config.options = [:log]
14
+ config.helpers = []
15
+ config.except = []
16
+ config.only = []
17
+ config.options = [:log]
18
18
  end
@@ -9,12 +9,12 @@ SimpleHelpers.configure do |config|
9
9
  # config.helpers will NOT be created automatically in these controllers
10
10
  # *** keep it empty if you would allow all controlers
11
11
  # example: [SessionsController]
12
- # config.blacklist = []
12
+ # config.except = []
13
13
 
14
14
  # config.helpers will be created automatically in these controllers
15
15
  # *** keep it empty if you would allow all controlers
16
- # example: [ApplicationController]
17
- # config.whitelist = []
16
+ # example: [PostsController]
17
+ # config.only = []
18
18
 
19
19
  # Options:
20
20
  # :pluralize => I18n pluralized helper names
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-19 00:00:00.000000000 Z
12
+ date: 2012-07-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: 4057646735331039904
127
+ hash: 632949602249206258
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: 4057646735331039904
136
+ hash: 632949602249206258
137
137
  requirements: []
138
138
  rubyforge_project:
139
139
  rubygems_version: 1.8.23