the_role 2.5.1 → 2.5.2

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: 2da50021e5faf84fee4fc36f394a7261b6656f0d
4
- data.tar.gz: de454cfc3be8494c1281d56dbc95a908a00fedda
3
+ metadata.gz: 12b0ae2b2e4a5afcc9026717b0c81155f02fa4d7
4
+ data.tar.gz: 7867224f80ba6715d9d3a562e77ea04f642a592f
5
5
  SHA512:
6
- metadata.gz: 240a0b2438d2ab2031958de50996c7b05c5ca497569a2ee0308b2d1f19c8932fc885b08c55be2eb864d57d5defc4c2b45ce671bbdcfa2f92c400e61a68d8b80f
7
- data.tar.gz: 2a8c73e9f25e3ce0f53fd0472b913f86c92e03ed447b1f875dbed910350a06fe0f0dc469d6dead73b9f1c25c361c3d94c2d0e3aadb81da43ab2cf51be5439731
6
+ metadata.gz: e768d539904516605ab9be3e3de04debe263116639edf2891eef306ced2db0c16008d3a7f9cfe3cc73f3ec054ca62d60deda76703e821c99d083d20ee7ee8681
7
+ data.tar.gz: d343d3fc7478400b0903eb278b0db31ce0653a27bf69ef478d9bd91486fafa06843bf9c57b01bd55c0903ff9ae07aa1ef4239534953396fa72c482ac5ffc1d4d
data/README.md CHANGED
@@ -506,7 +506,7 @@ new_role_hash = {
506
506
 
507
507
  ### MIT-LICENSE
508
508
 
509
- ##### Copyright (c) 2012 [Ilya N.Zykin]
509
+ ##### Copyright (c) 2012-2014 [Ilya N.Zykin]
510
510
 
511
511
  Permission is hereby granted, free of charge, to any person obtaining
512
512
  a copy of this software and associated documentation files (the
@@ -2,15 +2,15 @@ module TheRole
2
2
  module Base
3
3
  def has_section? section_name
4
4
  hash = role_hash
5
- section_name = section_name.to_s.to_slug_param(delimiter: '_')
5
+ section_name = section_name.to_slug_param(sep: '_')
6
6
  return true if hash[section_name]
7
7
  false
8
8
  end
9
9
 
10
10
  def has_role? section_name, rule_name
11
11
  hash = role_hash
12
- section_name = section_name.to_s.to_slug_param(delimiter: '_')
13
- rule_name = rule_name.to_s.to_slug_param(delimiter: '_')
12
+ section_name = section_name.to_slug_param(sep: '_')
13
+ rule_name = rule_name.to_slug_param(sep: '_')
14
14
 
15
15
  return true if hash.try(:[], 'system').try(:[], 'administrator')
16
16
  return true if hash.try(:[], 'moderator').try(:[], section_name)
@@ -26,7 +26,7 @@ module TheRole
26
26
  end
27
27
 
28
28
  def moderator? section_name
29
- section_name = section_name.to_slug_param(delimiter: '_')
29
+ section_name = section_name.to_slug_param(sep: '_')
30
30
  has_role? section_name, 'any_crazy_name'
31
31
  end
32
32
 
@@ -12,7 +12,7 @@ module TheRole
12
12
  alias_method :any?, :any_role?
13
13
 
14
14
  def has_section? section_name
15
- to_hash.key? section_name.to_s.to_slug_param(delimiter: '_')
15
+ to_hash.key? section_name.to_slug_param(sep: '_')
16
16
  end
17
17
 
18
18
  included do
@@ -22,7 +22,7 @@ module TheRole
22
22
  validates :description, presence: true
23
23
 
24
24
  before_save do
25
- self.name = name.to_s.to_slug_param(delimiter: '_')
25
+ self.name = name.to_slug_param(sep: '_')
26
26
 
27
27
  rules_set = self.the_role
28
28
  self.the_role = {}.to_json if rules_set.blank? # blank
@@ -41,7 +41,7 @@ module TheRole
41
41
  def create_section section_name = nil
42
42
  return false unless section_name
43
43
  role = to_hash
44
- section_name = section_name.to_s.to_slug_param(delimiter: '_')
44
+ section_name = section_name.to_slug_param(sep: '_')
45
45
  return false if section_name.blank?
46
46
  return true if role[section_name]
47
47
  role[section_name] = {}
@@ -53,8 +53,8 @@ module TheRole
53
53
  return false unless create_section(section_name)
54
54
 
55
55
  role = to_hash
56
- rule_name = rule_name.to_s.to_slug_param(delimiter: '_')
57
- section_name = section_name.to_s.to_slug_param(delimiter: '_')
56
+ rule_name = rule_name.to_slug_param(sep: '_')
57
+ section_name = section_name.to_slug_param(sep: '_')
58
58
 
59
59
  return true if role[section_name][rule_name]
60
60
  role[section_name][rule_name] = false
@@ -91,8 +91,8 @@ module TheRole
91
91
 
92
92
  def rule_on section_name, rule_name
93
93
  role = to_hash
94
- rule_name = rule_name.to_s.to_slug_param(delimiter: '_')
95
- section_name = section_name.to_s.to_slug_param(delimiter: '_')
94
+ rule_name = rule_name.to_slug_param(sep: '_')
95
+ section_name = section_name.to_slug_param(sep: '_')
96
96
 
97
97
  return false unless role[section_name]
98
98
  return false unless role[section_name].key? rule_name
@@ -104,8 +104,8 @@ module TheRole
104
104
 
105
105
  def rule_off section_name, rule_name
106
106
  role = to_hash
107
- rule_name = rule_name.to_s.to_slug_param(delimiter: '_')
108
- section_name = section_name.to_s.to_slug_param(delimiter: '_')
107
+ rule_name = rule_name.to_slug_param(sep: '_')
108
+ section_name = section_name.to_slug_param(sep: '_')
109
109
 
110
110
  return false unless role[section_name]
111
111
  return false unless role[section_name].key? rule_name
@@ -120,7 +120,7 @@ module TheRole
120
120
  def delete_section section_name = nil
121
121
  return false unless section_name
122
122
  role = to_hash
123
- section_name = section_name.to_s.to_slug_param(delimiter: '_')
123
+ section_name = section_name.to_slug_param(sep: '_')
124
124
 
125
125
  return false if section_name.blank?
126
126
  return false unless role[section_name]
@@ -131,8 +131,8 @@ module TheRole
131
131
 
132
132
  def delete_rule section_name, rule_name
133
133
  role = to_hash
134
- rule_name = rule_name.to_s.to_slug_param(delimiter: '_')
135
- section_name = section_name.to_s.to_slug_param(delimiter: '_')
134
+ rule_name = rule_name.to_slug_param(sep: '_')
135
+ section_name = section_name.to_slug_param(sep: '_')
136
136
 
137
137
  return false unless role[section_name]
138
138
  return false unless role[section_name].key? rule_name
data/lib/the_role/hash.rb CHANGED
@@ -34,7 +34,7 @@ class Hash
34
34
 
35
35
  unless {}.respond_to?(:underscorify_keys)
36
36
  def underscorify_keys
37
- deep_transform_keys{ |key| key.to_s.to_slug_param(delimiter: '_') }
37
+ deep_transform_keys{ |key| key.to_slug_param(sep: '_') }
38
38
  end
39
39
 
40
40
  def underscorify_keys!
@@ -1,3 +1,3 @@
1
1
  module TheRole
2
- VERSION = "2.5.1"
2
+ VERSION = "2.5.2"
3
3
  end
@@ -18,8 +18,12 @@ gem 'uglifier'
18
18
  gem 'jquery-rails'
19
19
  gem 'jbuilder', '~> 1.0.1'
20
20
 
21
- gem 'the_role', "~> 2.5"
22
- # path: '../../'
21
+ gem 'the_string_to_slug',
22
+ path: "../../../the_string_to_slug"
23
+
24
+ gem 'the_role',
25
+ # "~> 2.5.1"
26
+ path: '../../'
23
27
 
24
28
  gem 'the_role_bootstrap3_ui',
25
29
  github: 'the-teacher/the_role_bootstrap3_ui',
@@ -6,6 +6,8 @@ require 'rails/all'
6
6
  # you've limited to :test, :development, or :production.
7
7
  Bundler.require(:default, Rails.env)
8
8
 
9
+ I18n.enforce_available_locales = true
10
+
9
11
  module RailsApp
10
12
  class Application < Rails::Application
11
13
  # Settings in config/environments/* take precedence over those specified here.
@@ -4,29 +4,29 @@ require 'spec_helper'
4
4
 
5
5
  describe "String to slug" do
6
6
  it 'string process 1' do
7
- 'hello world!'.to_slug_param(delimiter: '_').should eq 'hello_world'
7
+ 'hello world!'.to_slug_param(sep: '_').should eq 'hello_world'
8
8
  end
9
9
 
10
10
  it 'string process 2' do
11
- :hello_world!.to_s.to_slug_param(delimiter: '_').should eq 'hello_world'
11
+ :hello_world!.to_slug_param(sep: '_').should eq 'hello_world'
12
12
  end
13
13
 
14
14
  it 'string process 3' do
15
- "hello ! world".to_slug_param(delimiter: '_').should eq 'hello_world'
15
+ "hello ! world".to_slug_param(sep: '_').should eq 'hello_world'
16
16
  end
17
17
 
18
18
  it 'string process 4' do
19
- "HELLO $!= WorlD".to_slug_param(delimiter: '_').should eq 'hello_world'
19
+ "HELLO $!= WorlD".to_slug_param(sep: '_').should eq 'hello_world'
20
20
  end
21
21
 
22
22
  it 'string process 5' do
23
- "HELLO---WorlD".to_slug_param(delimiter: '_').should eq 'hello_world'
23
+ "HELLO---WorlD".to_slug_param(sep: '_').should eq 'hello_world'
24
24
  end
25
25
 
26
26
  it "should work with Controller Name" do
27
27
  ctrl = PagesController.new
28
28
  ctrl.controller_path
29
- ctrl.controller_path.to_slug_param(delimiter: '_').should eq 'pages'
29
+ ctrl.controller_path.to_slug_param(sep: '_').should eq 'pages'
30
30
  end
31
31
 
32
32
  it "should work with Nested Controller Name" do
@@ -34,6 +34,6 @@ describe "String to slug" do
34
34
  ctrl = Admin::PagesController.new
35
35
  ctrl.controller_path
36
36
 
37
- ctrl.controller_path.to_slug_param(delimiter: '_').should eq 'admin_pages'
37
+ ctrl.controller_path.to_slug_param(sep: '_').should eq 'admin_pages'
38
38
  end
39
39
  end
data/the_role.gemspec CHANGED
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency 'the_string_to_slug', '~> 1.1'
21
+ s.add_dependency 'the_string_to_slug', '~> 1.2'
22
22
  s.add_runtime_dependency 'rails', ['>= 3', '< 5']
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_role
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya N. Zykin [the-teacher]
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-20 00:00:00.000000000 Z
11
+ date: 2014-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: the_string_to_slug
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '1.1'
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement