inflector_literals 1.0.0 → 1.0.1

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.
Files changed (4) hide show
  1. data/init.rb +1 -25
  2. data/install.rb +0 -0
  3. data/lib/inflector_literals.rb +25 -0
  4. metadata +4 -2
data/init.rb CHANGED
@@ -1,25 +1 @@
1
- # InflectorLiterals
2
- #
3
- # This exists so I can say inflect.literal, pass it two strings, and control exactly
4
- # what humanize returns for some strings. The default humanize calls capitalize on
5
- # the result, which I don't want.
6
-
7
- module InflectorLiterals
8
- def literal(str, replacement)
9
- literals.insert(0, [str, replacement])
10
- end
11
-
12
- def literals ; @literals ||= [] ; end
13
- end
14
-
15
- ActiveSupport::Inflector::Inflections.send :include, InflectorLiterals
16
-
17
- # I hate having to do this but I couldn't find another way.
18
- module ActiveSupport::Inflector
19
- alias humanize_without_literals humanize
20
-
21
- def humanize word
22
- inflections.literals.each { |(str, replacement)| return replacement if word == str }
23
- humanize_without_literals word
24
- end
25
- end
1
+ require File.join(File.dirname(__FILE__), "lib", "inflector_literals.rb")
data/install.rb ADDED
File without changes
@@ -0,0 +1,25 @@
1
+ # InflectorLiterals
2
+ #
3
+ # This exists so I can say inflect.literal, pass it two strings, and control exactly
4
+ # what humanize returns for some strings. The default humanize calls capitalize on
5
+ # the result, which I don't want.
6
+
7
+ module InflectorLiterals
8
+ def literal(str, replacement)
9
+ literals.insert(0, [str, replacement])
10
+ end
11
+
12
+ def literals ; @literals ||= [] ; end
13
+ end
14
+
15
+ ActiveSupport::Inflector::Inflections.send :include, InflectorLiterals
16
+
17
+ # I hate having to do this but I couldn't find another way.
18
+ module ActiveSupport::Inflector
19
+ alias humanize_without_literals humanize
20
+
21
+ def humanize word
22
+ inflections.literals.each { |(str, replacement)| return replacement if word == str }
23
+ humanize_without_literals word
24
+ end
25
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrews, Ross
@@ -31,6 +31,8 @@ files:
31
31
  - README
32
32
  - Rakefile
33
33
  - init.rb
34
+ - install.rb
35
+ - lib/inflector_literals.rb
34
36
  has_rdoc: true
35
37
  homepage: https://github.com/randrews/inflector_literals
36
38
  licenses: []