Class: ActiveSupport::Inflector::Inflections::Uncountables
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/inflector/inflections.rb
Constant Summary
Constants inherited from Array
Constants included from Diff::LCS
Diff::LCS::BalancedCallbacks, Diff::LCS::PATCH_MAP, Diff::LCS::SequenceCallbacks, Diff::LCS::VERSION
Instance Method Summary collapse
- #<<(*word) ⇒ Object
- #add(words) ⇒ Object
- #delete(entry) ⇒ Object
-
#initialize ⇒ Uncountables
constructor
A new instance of Uncountables.
- #uncountable?(str) ⇒ Boolean
Methods inherited from Array
#as_json, #compact_blank!, #deep_dup, #excluding, #extract!, #extract_options!, #fifth, #forty_two, #fourth, #from, #in_groups, #in_groups_of, #including, #inquiry, #second, #second_to_last, #split, #sum, #third, #third_to_last, #to, #to_default_s, #to_fs, #to_param, #to_query, #to_s, #to_sentence, #to_xml, wrap
Methods included from Diff::LCS
callbacks_for, #diff, diff, diff_traversal, #lcs, lcs, patch, #patch, #patch!, patch!, #patch_me, #sdiff, sdiff, #traverse_balanced, traverse_balanced, traverse_sequences, #traverse_sequences, #unpatch, #unpatch!, unpatch!, #unpatch_me
Constructor Details
#initialize ⇒ Uncountables
Returns a new instance of Uncountables.
32 33 34 35 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/inflector/inflections.rb', line 32 def initialize @regex_array = [] super end |
Instance Method Details
#<<(*word) ⇒ Object
42 43 44 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/inflector/inflections.rb', line 42 def <<(*word) add(word) end |
#add(words) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/inflector/inflections.rb', line 46 def add(words) words = words.flatten.map(&:downcase) concat(words) @regex_array += words.map { |word| to_regex(word) } self end |
#delete(entry) ⇒ Object
37 38 39 40 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/inflector/inflections.rb', line 37 def delete(entry) super entry @regex_array.delete(to_regex(entry)) end |
#uncountable?(str) ⇒ Boolean
53 54 55 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/inflector/inflections.rb', line 53 def uncountable?(str) @regex_array.any? { |regex| regex.match? str } end |