semantic_id 0.1.0 → 0.2.0

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.
@@ -1,6 +1 @@
1
- require 'semantic_id/helper'
2
- require 'rails'
3
-
4
- ActiveSupport.on_load(:action_view) do
5
- include SemanticId::Helper
6
- end
1
+ require 'semantic_id/railtie' if defined?(Rails)
@@ -0,0 +1,22 @@
1
+ require 'semantic_id/version'
2
+
3
+ module SemanticId
4
+
5
+ module Helper
6
+ def semantic_id
7
+ string = String.new
8
+
9
+ case
10
+ when controller.action_name =~ /new|edit/
11
+ string += controller.action_name + "_"
12
+ when controller.action_name =~ /index|create/
13
+ string += controller.controller_name
14
+ else
15
+ string += controller.controller_name.singularize
16
+ end
17
+
18
+ string += "_view"
19
+ end
20
+ end
21
+
22
+ end
@@ -0,0 +1,9 @@
1
+ require 'semantic_id/helper'
2
+
3
+ module SemanticId
4
+ class SemanticIdRailtie < Rails::Railtie
5
+ ActiveSupport.on_load(:action_view) do
6
+ include SemanticId::Helper
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module SemanticId
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-07-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2155796020 !ruby/object:Gem::Requirement
16
+ requirement: &2154111480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2155796020
24
+ version_requirements: *2154111480
25
25
  description: Semantic_ID is a very simple helper that creates a view-specific semantic
26
26
  selector string following the same convention as the Rails Route Helpers. IE, the
27
27
  ExamplesController#Index view would return "examples_view".
@@ -37,6 +37,8 @@ files:
37
37
  - Rakefile
38
38
  - init.rb
39
39
  - lib/semantic_id.rb
40
+ - lib/semantic_id/helper.rb
41
+ - lib/semantic_id/railtie.rb
40
42
  - lib/semantic_id/version.rb
41
43
  - semantic_id.gemspec
42
44
  homepage: http://github.com/burlesona/semantic_id