Class: Kangaru::Inflectors::Tokeniser
- Inherits:
-
Object
- Object
- Kangaru::Inflectors::Tokeniser
- Defined in:
- lib/kangaru/inflectors/tokeniser.rb
Constant Summary collapse
- GROUP_DELIMITER =
%r{/|::}
- TOKEN_DELIMITER =
/[_-]+|(?=[A-Z][a-z])/
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(string) ⇒ Tokeniser
constructor
A new instance of Tokeniser.
- #split ⇒ Object
Constructor Details
#initialize(string) ⇒ Tokeniser
Returns a new instance of Tokeniser.
9 10 11 |
# File 'lib/kangaru/inflectors/tokeniser.rb', line 9 def initialize(string) @string = string end |
Instance Attribute Details
#string ⇒ Object (readonly)
Returns the value of attribute string.
7 8 9 |
# File 'lib/kangaru/inflectors/tokeniser.rb', line 7 def string @string end |
Instance Method Details
#split ⇒ Object
13 14 15 16 17 |
# File 'lib/kangaru/inflectors/tokeniser.rb', line 13 def split string.split(GROUP_DELIMITER).map do |group| group.split(TOKEN_DELIMITER) end end |