motion_support 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'bubble-wrap', github: 'rubymotion/BubbleWrap'
4
+ gem "motion-redgreen", :github => "farcaller/motion-redgreen"
4
5
 
5
6
  gemspec
data/README.md CHANGED
@@ -22,6 +22,9 @@ In your Rakefile
22
22
 
23
23
  ```ruby
24
24
  require 'motion_support'
25
+
26
+ Note this will not include any motion support you must say you want all
27
+ if thats what you want
25
28
  ```
26
29
 
27
30
  The idea is that you can choose from a multiple modules so that you can easily choose which parts
data/Rakefile CHANGED
@@ -5,3 +5,12 @@ require "bundler/gem_tasks"
5
5
  Bundler.setup
6
6
  Bundler.require
7
7
  require 'bubble-wrap/test'
8
+
9
+ require "motion_support/all"
10
+
11
+ # Bug RubyMotion 1.15
12
+ Motion::Project::App.setup do |app|
13
+ app.redgreen_style = :full
14
+ spec_files = app.spec_files + Dir.glob(File.join(app.specs_dir, '**', '*.rb'))
15
+ app.instance_variable_set("@spec_files", spec_files.uniq!)
16
+ end
@@ -1,6 +1,12 @@
1
1
  require 'bubble-wrap/loader'
2
2
 
3
- require File.expand_path('../concern', __FILE__)
3
+ # Base
4
+ require "motion_support/concern"
5
+ require "motion_support/inflections"
6
+
7
+ # Core Exts
8
+ require "motion_support/core_ext"
9
+
10
+ # Inflector
11
+ require "motion_support/inflector"
4
12
 
5
- # Core Ext Array
6
- require File.expand_path('../core_ext/array/extract_options', __FILE__)
@@ -0,0 +1,2 @@
1
+ require 'bubble-wrap/loader'
2
+ BubbleWrap.require('motion/core_ext/array/prepend_append.rb')
@@ -0,0 +1,4 @@
1
+ require 'bubble-wrap/loader'
2
+ Dir["#{File.dirname(__FILE__)}/array/*.rb"].sort.each do |path|
3
+ require path
4
+ end
@@ -0,0 +1,2 @@
1
+ require 'bubble-wrap/loader'
2
+ BubbleWrap.require('motion/core_ext/string/inflections.rb')
@@ -0,0 +1,2 @@
1
+ require 'bubble-wrap/loader'
2
+ BubbleWrap.require('motion/core_ext/string/inflections.rb')
@@ -0,0 +1,4 @@
1
+ require 'bubble-wrap/loader'
2
+ Dir["#{File.dirname(__FILE__)}/core_ext/*.rb"].sort.each do |path|
3
+ require path
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'bubble-wrap/loader'
2
+ BubbleWrap.require('motion/**/*.rb') do
3
+ file('motion/inflections.rb').depends_on('motion/inflector/inflections.rb')
4
+ end
@@ -0,0 +1,4 @@
1
+ require 'bubble-wrap/loader'
2
+ BubbleWrap.require('motion/inflector/*.rb') do
3
+ file('motion/inflector/inflections.rb').depends_on('motion/core_ext/array/prepend_append.rb')
4
+ end
@@ -0,0 +1,5 @@
1
+ require 'bubble-wrap/loader'
2
+ BubbleWrap.require('motion/inflector/*.rb') do
3
+ file('motion/inflector/methods.rb').depends_on('motion/inflector/inflections.rb')
4
+ end
5
+
@@ -0,0 +1,6 @@
1
+ require 'bubble-wrap/loader'
2
+ Dir["#{File.dirname(__FILE__)}/inflector/*.rb"].sort.each do |path|
3
+ require path
4
+ end
5
+
6
+ BubbleWrap.require "motion/inflections"
@@ -1,3 +1,3 @@
1
1
  module MotionSupport
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -2,6 +2,4 @@ unless defined?(Motion::Project::Config)
2
2
  raise "This file must be required within a RubyMotion project Rakefile."
3
3
  end
4
4
 
5
- require "motion_support/version"
6
-
7
- require File.expand_path('../motion_support/all', __FILE__)
5
+ require "motion_support/version" unless defined?(MotionSupport::VERSION)
@@ -0,0 +1,7 @@
1
+ class Array
2
+ # The human way of thinking about adding stuff to the end of a list is with append
3
+ alias_method :append, :<<
4
+
5
+ # The human way of thinking about adding stuff to the beginning of a list is with prepend
6
+ alias_method :prepend, :unshift
7
+ end
@@ -0,0 +1,179 @@
1
+ # String inflections define new methods on the String class to transform names for different purposes.
2
+ # For instance, you can figure out the name of a table from the name of a class.
3
+ #
4
+ # 'ScaleScore'.tableize # => "scale_scores"
5
+ #
6
+ class String
7
+ # Returns the plural form of the word in the string.
8
+ #
9
+ # If the optional parameter +count+ is specified,
10
+ # the singular form will be returned if <tt>count == 1</tt>.
11
+ # For any other value of +count+ the plural will be returned.
12
+ #
13
+ # 'post'.pluralize # => "posts"
14
+ # 'octopus'.pluralize # => "octopi"
15
+ # 'sheep'.pluralize # => "sheep"
16
+ # 'words'.pluralize # => "words"
17
+ # 'the blue mailman'.pluralize # => "the blue mailmen"
18
+ # 'CamelOctopus'.pluralize # => "CamelOctopi"
19
+ # 'apple'.pluralize(1) # => "apple"
20
+ # 'apple'.pluralize(2) # => "apples"
21
+ def pluralize(count = nil)
22
+ if count == 1
23
+ self
24
+ else
25
+ MotionSupport::Inflector.pluralize(self)
26
+ end
27
+ end
28
+
29
+ # The reverse of +pluralize+, returns the singular form of a word in a string.
30
+ #
31
+ # 'posts'.singularize # => "post"
32
+ # 'octopi'.singularize # => "octopus"
33
+ # 'sheep'.singularize # => "sheep"
34
+ # 'word'.singularize # => "word"
35
+ # 'the blue mailmen'.singularize # => "the blue mailman"
36
+ # 'CamelOctopi'.singularize # => "CamelOctopus"
37
+ def singularize
38
+ MotionSupport::Inflector.singularize(self)
39
+ end
40
+
41
+ # +constantize+ tries to find a declared constant with the name specified
42
+ # in the string. It raises a NameError when the name is not in CamelCase
43
+ # or is not initialized. See MotionSupport::Inflector.constantize
44
+ #
45
+ # 'Module'.constantize # => Module
46
+ # 'Class'.constantize # => Class
47
+ # 'blargle'.constantize # => NameError: wrong constant name blargle
48
+ def constantize
49
+ MotionSupport::Inflector.constantize(self)
50
+ end
51
+
52
+ # +safe_constantize+ tries to find a declared constant with the name specified
53
+ # in the string. It returns nil when the name is not in CamelCase
54
+ # or is not initialized. See MotionSupport::Inflector.safe_constantize
55
+ #
56
+ # 'Module'.safe_constantize # => Module
57
+ # 'Class'.safe_constantize # => Class
58
+ # 'blargle'.safe_constantize # => nil
59
+ def safe_constantize
60
+ MotionSupport::Inflector.safe_constantize(self)
61
+ end
62
+
63
+ # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
64
+ # is set to <tt>:lower</tt> then camelize produces lowerCamelCase.
65
+ #
66
+ # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
67
+ #
68
+ # 'active_record'.camelize # => "ActiveRecord"
69
+ # 'active_record'.camelize(:lower) # => "activeRecord"
70
+ # 'active_record/errors'.camelize # => "ActiveRecord::Errors"
71
+ # 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors"
72
+ def camelize(first_letter = :upper)
73
+ case first_letter
74
+ when :upper
75
+ MotionSupport::Inflector.camelize(self, true)
76
+ when :lower
77
+ MotionSupport::Inflector.camelize(self, false)
78
+ end
79
+ end
80
+ alias_method :camelcase, :camelize
81
+
82
+ # Capitalizes all the words and replaces some characters in the string to create
83
+ # a nicer looking title. +titleize+ is meant for creating pretty output. It is not
84
+ # used in the Rails internals.
85
+ #
86
+ # +titleize+ is also aliased as +titlecase+.
87
+ #
88
+ # 'man from the boondocks'.titleize # => "Man From The Boondocks"
89
+ # 'x-men: the last stand'.titleize # => "X Men: The Last Stand"
90
+ def titleize
91
+ MotionSupport::Inflector.titleize(self)
92
+ end
93
+ alias_method :titlecase, :titleize
94
+
95
+ # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
96
+ #
97
+ # +underscore+ will also change '::' to '/' to convert namespaces to paths.
98
+ #
99
+ # 'ActiveModel'.underscore # => "active_model"
100
+ # 'ActiveModel::Errors'.underscore # => "active_model/errors"
101
+ def underscore
102
+ MotionSupport::Inflector.underscore(self)
103
+ end
104
+
105
+ # Replaces underscores with dashes in the string.
106
+ #
107
+ # 'puni_puni'.dasherize # => "puni-puni"
108
+ def dasherize
109
+ MotionSupport::Inflector.dasherize(self)
110
+ end
111
+
112
+ # Removes the module part from the constant expression in the string.
113
+ #
114
+ # 'ActiveRecord::CoreExtensions::String::Inflections'.demodulize # => "Inflections"
115
+ # 'Inflections'.demodulize # => "Inflections"
116
+ #
117
+ # See also +deconstantize+.
118
+ def demodulize
119
+ MotionSupport::Inflector.demodulize(self)
120
+ end
121
+
122
+ # Removes the rightmost segment from the constant expression in the string.
123
+ #
124
+ # 'Net::HTTP'.deconstantize # => "Net"
125
+ # '::Net::HTTP'.deconstantize # => "::Net"
126
+ # 'String'.deconstantize # => ""
127
+ # '::String'.deconstantize # => ""
128
+ # ''.deconstantize # => ""
129
+ #
130
+ # See also +demodulize+.
131
+ def deconstantize
132
+ MotionSupport::Inflector.deconstantize(self)
133
+ end
134
+
135
+ # Creates the name of a table like Rails does for models to table names. This method
136
+ # uses the +pluralize+ method on the last word in the string.
137
+ #
138
+ # 'RawScaledScorer'.tableize # => "raw_scaled_scorers"
139
+ # 'egg_and_ham'.tableize # => "egg_and_hams"
140
+ # 'fancyCategory'.tableize # => "fancy_categories"
141
+ def tableize
142
+ MotionSupport::Inflector.tableize(self)
143
+ end
144
+
145
+ # Create a class name from a plural table name like Rails does for table names to models.
146
+ # Note that this returns a string and not a class. (To convert to an actual class
147
+ # follow +classify+ with +constantize+.)
148
+ #
149
+ # 'egg_and_hams'.classify # => "EggAndHam"
150
+ # 'posts'.classify # => "Post"
151
+ #
152
+ # Singular names are not handled correctly.
153
+ #
154
+ # 'business'.classify # => "Busines"
155
+ def classify
156
+ MotionSupport::Inflector.classify(self)
157
+ end
158
+
159
+ # Capitalizes the first word, turns underscores into spaces, and strips '_id'.
160
+ # Like +titleize+, this is meant for creating pretty output.
161
+ #
162
+ # 'employee_salary' # => "Employee salary"
163
+ # 'author_id' # => "Author"
164
+ def humanize
165
+ MotionSupport::Inflector.humanize(self)
166
+ end
167
+
168
+ # Creates a foreign key name from a class name.
169
+ # +separate_class_name_and_id_with_underscore+ sets whether
170
+ # the method should put '_' between the name and 'id'.
171
+ #
172
+ # 'Message'.foreign_key # => "message_id"
173
+ # 'Message'.foreign_key(false) # => "messageid"
174
+ # 'Admin::Post'.foreign_key # => "post_id"
175
+ def foreign_key(separate_class_name_and_id_with_underscore = true)
176
+ MotionSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore)
177
+ end
178
+ end
179
+
@@ -0,0 +1,64 @@
1
+ module MotionSupport
2
+ Inflector.inflections do |inflect|
3
+ inflect.plural(/$/, 's')
4
+ inflect.plural(/s$/i, 's')
5
+ inflect.plural(/^(ax|test)is$/i, '\1es')
6
+ inflect.plural(/(octop|vir)us$/i, '\1i')
7
+ inflect.plural(/(octop|vir)i$/i, '\1i')
8
+ inflect.plural(/(alias|status)$/i, '\1es')
9
+ inflect.plural(/(bu)s$/i, '\1ses')
10
+ inflect.plural(/(buffal|tomat)o$/i, '\1oes')
11
+ inflect.plural(/([ti])um$/i, '\1a')
12
+ inflect.plural(/([ti])a$/i, '\1a')
13
+ inflect.plural(/sis$/i, 'ses')
14
+ inflect.plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves')
15
+ inflect.plural(/(hive)$/i, '\1s')
16
+ inflect.plural(/([^aeiouy]|qu)y$/i, '\1ies')
17
+ inflect.plural(/(x|ch|ss|sh)$/i, '\1es')
18
+ inflect.plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices')
19
+ inflect.plural(/^(m|l)ouse$/i, '\1ice')
20
+ inflect.plural(/^(m|l)ice$/i, '\1ice')
21
+ inflect.plural(/^(ox)$/i, '\1en')
22
+ inflect.plural(/^(oxen)$/i, '\1')
23
+ inflect.plural(/(quiz)$/i, '\1zes')
24
+
25
+ inflect.singular(/s$/i, '')
26
+ inflect.singular(/(ss)$/i, '\1')
27
+ inflect.singular(/(n)ews$/i, '\1ews')
28
+ inflect.singular(/([ti])a$/i, '\1um')
29
+ inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '\1sis')
30
+ inflect.singular(/(^analy)(sis|ses)$/i, '\1sis')
31
+ inflect.singular(/([^f])ves$/i, '\1fe')
32
+ inflect.singular(/(hive)s$/i, '\1')
33
+ inflect.singular(/(tive)s$/i, '\1')
34
+ inflect.singular(/([lr])ves$/i, '\1f')
35
+ inflect.singular(/([^aeiouy]|qu)ies$/i, '\1y')
36
+ inflect.singular(/(s)eries$/i, '\1eries')
37
+ inflect.singular(/(m)ovies$/i, '\1ovie')
38
+ inflect.singular(/(x|ch|ss|sh)es$/i, '\1')
39
+ inflect.singular(/^(m|l)ice$/i, '\1ouse')
40
+ inflect.singular(/(bus)(es)?$/i, '\1')
41
+ inflect.singular(/(o)es$/i, '\1')
42
+ inflect.singular(/(shoe)s$/i, '\1')
43
+ inflect.singular(/(cris|test)(is|es)$/i, '\1is')
44
+ inflect.singular(/^(a)x[ie]s$/i, '\1xis')
45
+ inflect.singular(/(octop|vir)(us|i)$/i, '\1us')
46
+ inflect.singular(/(alias|status)(es)?$/i, '\1')
47
+ inflect.singular(/^(ox)en/i, '\1')
48
+ inflect.singular(/(vert|ind)ices$/i, '\1ex')
49
+ inflect.singular(/(matr)ices$/i, '\1ix')
50
+ inflect.singular(/(quiz)zes$/i, '\1')
51
+ inflect.singular(/(database)s$/i, '\1')
52
+
53
+ inflect.irregular('person', 'people')
54
+ inflect.irregular('man', 'men')
55
+ inflect.irregular('child', 'children')
56
+ inflect.irregular('sex', 'sexes')
57
+ inflect.irregular('move', 'moves')
58
+ inflect.irregular('cow', 'kine')
59
+ inflect.irregular('zombie', 'zombies')
60
+
61
+ inflect.uncountable(%w(equipment information rice money species series fish sheep jeans police))
62
+ end
63
+ end
64
+
@@ -0,0 +1,174 @@
1
+ module MotionSupport
2
+ module Inflector
3
+ extend self
4
+
5
+ # A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional
6
+ # inflection rules.
7
+ #
8
+ # MotionSupport::Inflector.inflections do |inflect|
9
+ # inflect.plural /^(ox)$/i, '\1\2en'
10
+ # inflect.singular /^(ox)en/i, '\1'
11
+ #
12
+ # inflect.irregular 'octopus', 'octopi'
13
+ #
14
+ # inflect.uncountable "equipment"
15
+ # end
16
+ #
17
+ # New rules are added at the top. So in the example above, the irregular rule for octopus will now be the first of the
18
+ # pluralization and singularization rules that is runs. This guarantees that your rules run before any of the rules that may
19
+ # already have been loaded.
20
+ class Inflections
21
+ def self.instance
22
+ @__instance__ ||= new
23
+ end
24
+
25
+ attr_reader :plurals, :singulars, :uncountables, :humans, :acronyms, :acronym_regex
26
+
27
+ def initialize
28
+ @plurals, @singulars, @uncountables, @humans, @acronyms, @acronym_regex = [], [], [], [], {}, /(?=a)b/
29
+ end
30
+
31
+ # Private, for the test suite.
32
+ def initialize_dup(orig)
33
+ %w(plurals singulars uncountables humans acronyms acronym_regex).each do |scope|
34
+ instance_variable_set("@#{scope}", orig.send(scope).dup)
35
+ end
36
+ end
37
+
38
+ # Specifies a new acronym. An acronym must be specified as it will appear in a camelized string. An underscore
39
+ # string that contains the acronym will retain the acronym when passed to `camelize`, `humanize`, or `titleize`.
40
+ # A camelized string that contains the acronym will maintain the acronym when titleized or humanized, and will
41
+ # convert the acronym into a non-delimited single lowercase word when passed to +underscore+.
42
+ #
43
+ # acronym 'HTML'
44
+ # titleize 'html' #=> 'HTML'
45
+ # camelize 'html' #=> 'HTML'
46
+ # underscore 'MyHTML' #=> 'my_html'
47
+ #
48
+ # The acronym, however, must occur as a delimited unit and not be part of another word for conversions to recognize it:
49
+ #
50
+ # acronym 'HTTP'
51
+ # camelize 'my_http_delimited' #=> 'MyHTTPDelimited'
52
+ # camelize 'https' #=> 'Https', not 'HTTPs'
53
+ # underscore 'HTTPS' #=> 'http_s', not 'https'
54
+ #
55
+ # acronym 'HTTPS'
56
+ # camelize 'https' #=> 'HTTPS'
57
+ # underscore 'HTTPS' #=> 'https'
58
+ #
59
+ # Note: Acronyms that are passed to `pluralize` will no longer be recognized, since the acronym will not occur as
60
+ # a delimited unit in the pluralized result. To work around this, you must specify the pluralized form as an
61
+ # acronym as well:
62
+ #
63
+ # acronym 'API'
64
+ # camelize(pluralize('api')) #=> 'Apis'
65
+ #
66
+ # acronym 'APIs'
67
+ # camelize(pluralize('api')) #=> 'APIs'
68
+ #
69
+ # `acronym` may be used to specify any word that contains an acronym or otherwise needs to maintain a non-standard
70
+ # capitalization. The only restriction is that the word must begin with a capital letter.
71
+ #
72
+ # acronym 'RESTful'
73
+ # underscore 'RESTful' #=> 'restful'
74
+ # underscore 'RESTfulController' #=> 'restful_controller'
75
+ # titleize 'RESTfulController' #=> 'RESTful Controller'
76
+ # camelize 'restful' #=> 'RESTful'
77
+ # camelize 'restful_controller' #=> 'RESTfulController'
78
+ #
79
+ # acronym 'McDonald'
80
+ # underscore 'McDonald' #=> 'mcdonald'
81
+ # camelize 'mcdonald' #=> 'McDonald'
82
+ def acronym(word)
83
+ @acronyms[word.downcase] = word
84
+ @acronym_regex = /#{@acronyms.values.join("|")}/
85
+ end
86
+
87
+ # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression.
88
+ # The replacement should always be a string that may include references to the matched data from the rule.
89
+ def plural(rule, replacement)
90
+ @uncountables.delete(rule) if rule.is_a?(String)
91
+ @uncountables.delete(replacement)
92
+ @plurals.prepend([rule, replacement])
93
+ end
94
+
95
+ # Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression.
96
+ # The replacement should always be a string that may include references to the matched data from the rule.
97
+ def singular(rule, replacement)
98
+ @uncountables.delete(rule) if rule.is_a?(String)
99
+ @uncountables.delete(replacement)
100
+ @singulars.prepend([rule, replacement])
101
+ end
102
+
103
+ # Specifies a new irregular that applies to both pluralization and singularization at the same time. This can only be used
104
+ # for strings, not regular expressions. You simply pass the irregular in singular and plural form.
105
+ #
106
+ # irregular 'octopus', 'octopi'
107
+ # irregular 'person', 'people'
108
+ def irregular(singular, plural)
109
+ @uncountables.delete(singular)
110
+ @uncountables.delete(plural)
111
+ if singular[0,1].upcase == plural[0,1].upcase
112
+ plural(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + plural[1..-1])
113
+ plural(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + plural[1..-1])
114
+ singular(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + singular[1..-1])
115
+ else
116
+ plural(Regexp.new("#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"), plural[0,1].upcase + plural[1..-1])
117
+ plural(Regexp.new("#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"), plural[0,1].downcase + plural[1..-1])
118
+ plural(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), plural[0,1].upcase + plural[1..-1])
119
+ plural(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), plural[0,1].downcase + plural[1..-1])
120
+ singular(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), singular[0,1].upcase + singular[1..-1])
121
+ singular(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), singular[0,1].downcase + singular[1..-1])
122
+ end
123
+ end
124
+
125
+ # Add uncountable words that shouldn't be attempted inflected.
126
+ #
127
+ # uncountable "money"
128
+ # uncountable "money", "information"
129
+ # uncountable %w( money information rice )
130
+ def uncountable(*words)
131
+ (@uncountables << words).flatten!
132
+ end
133
+
134
+ # Specifies a humanized form of a string by a regular expression rule or by a string mapping.
135
+ # When using a regular expression based replacement, the normal humanize formatting is called after the replacement.
136
+ # When a string is used, the human form should be specified as desired (example: 'The name', not 'the_name')
137
+ #
138
+ # human /_cnt$/i, '\1_count'
139
+ # human "legacy_col_person_name", "Name"
140
+ def human(rule, replacement)
141
+ @humans.prepend([rule, replacement])
142
+ end
143
+
144
+ # Clears the loaded inflections within a given scope (default is <tt>:all</tt>).
145
+ # Give the scope as a symbol of the inflection type, the options are: <tt>:plurals</tt>,
146
+ # <tt>:singulars</tt>, <tt>:uncountables</tt>, <tt>:humans</tt>.
147
+ #
148
+ # clear :all
149
+ # clear :plurals
150
+ def clear(scope = :all)
151
+ case scope
152
+ when :all
153
+ @plurals, @singulars, @uncountables, @humans = [], [], [], []
154
+ else
155
+ instance_variable_set "@#{scope}", []
156
+ end
157
+ end
158
+ end
159
+
160
+ # Yields a singleton instance of Inflector::Inflections so you can specify additional
161
+ # inflector rules.
162
+ #
163
+ # MotionSupport::Inflector.inflections do |inflect|
164
+ # inflect.uncountable "rails"
165
+ # end
166
+ def inflections
167
+ if block_given?
168
+ yield Inflections.instance
169
+ else
170
+ Inflections.instance
171
+ end
172
+ end
173
+ end
174
+ end