Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/strsyntax/stdlib_ext.rb,
lib/strsyntax/stdlib_ext.rb,
lib/strsyntax/stdlib_ext.rb
Instance Method Summary collapse
-
#parts ⇒ Object
Return an array containing the constituent parts of the string as represented by its syntax.
-
#structure ⇒ Object
Returns an array containing an amalgam of the syntax and parts of the string See #syntax and #parts for more information.
-
#syntax ⇒ Object
Returns an array containing the syntax of the string in terms of consonant and vowel groups.
Instance Method Details
#parts ⇒ Object
Return an array containing the constituent parts of the string as represented by its syntax. For example:
“groucho”.parts => [“g”,“ro”,“uc”,“ho”] “harpo”.parts => [“har”,“po”] “chico”.parts => [“c”,“hic”, “o”] “zeppo”.parts => [“zep”,“po”] “teasdale”.parts => [“te”,“as”,“dal”,“e”]
32 33 34 |
# File 'lib/strsyntax/stdlib_ext.rb', line 32 def parts StringSyntax::Parser.split( self ) end |
#structure ⇒ Object
47 48 49 |
# File 'lib/strsyntax/stdlib_ext.rb', line 47 def structure self.syntax.zip( self.parts ) end |
#syntax ⇒ Object
Returns an array containing the syntax of the string in terms of consonant and vowel groups. The groups are CVC, VCV, CV, VC, C, and V. For example:
“groucho”.syntax => [:c,:cv,:vc,:cv] “harpo”.syntax => [:cvc,:cv] “chico”.syntax => [:c,:cvc,:v] “zeppo”.syntax => [:cvc,:cv] “teasdale”.syntax => [:cv,:vc,:cvc,:v]
14 15 16 |
# File 'lib/strsyntax/stdlib_ext.rb', line 14 def syntax StringSyntax::Parser.parse( self ) end |