Class: Charosc::Text
- Inherits:
-
Object
- Object
- Charosc::Text
- Defined in:
- lib/charosc/text.rb
Instance Attribute Summary collapse
-
#str ⇒ Object
readonly
Returns the value of attribute str.
Instance Method Summary collapse
- #chars ⇒ Object
-
#initialize(str) ⇒ Text
constructor
str - String input.
- #words ⇒ Object
Constructor Details
#initialize(str) ⇒ Text
str - String input
6 7 8 |
# File 'lib/charosc/text.rb', line 6 def initialize(str) @str = str end |
Instance Attribute Details
#str ⇒ Object (readonly)
Returns the value of attribute str.
3 4 5 |
# File 'lib/charosc/text.rb', line 3 def str @str end |
Instance Method Details
#chars ⇒ Object
10 11 12 |
# File 'lib/charosc/text.rb', line 10 def chars @chars ||= str.scan(/./) end |
#words ⇒ Object
14 15 16 |
# File 'lib/charosc/text.rb', line 14 def words @words ||= str.split(/\s+/) end |