Class: Kangaru::Inflectors::Inflector
- Inherits:
-
Object
- Object
- Kangaru::Inflectors::Inflector
- Extended by:
- InflectorMacros
- Defined in:
- lib/kangaru/inflectors/inflector.rb
Direct Known Subclasses
ClassInflector, HumanInflector, PathInflector, SnakecaseInflector
Constant Summary collapse
- DEFAULT_GROUP_JOINER =
"/".freeze
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Class Method Summary collapse
Instance Method Summary collapse
- #inflect ⇒ Object
-
#initialize(string) ⇒ Inflector
constructor
A new instance of Inflector.
Methods included from InflectorMacros
filter_input_with, inherited, join_groups_with, join_tokens_with, post_process_with, transform_tokens_with
Constructor Details
#initialize(string) ⇒ Inflector
Returns a new instance of Inflector.
10 11 12 |
# File 'lib/kangaru/inflectors/inflector.rb', line 10 def initialize(string) @string = filter_input(string) end |
Instance Attribute Details
#string ⇒ Object (readonly)
Returns the value of attribute string.
8 9 10 |
# File 'lib/kangaru/inflectors/inflector.rb', line 8 def string @string end |
Class Method Details
.inflect(string) ⇒ Object
22 23 24 |
# File 'lib/kangaru/inflectors/inflector.rb', line 22 def self.inflect(string) new(string).inflect end |
Instance Method Details
#inflect ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/kangaru/inflectors/inflector.rb', line 14 def inflect post_process( join_groups( transform_and_join_tokens(tokeniser.split) ) ) end |