Class: BetterLorem::Loader
- Inherits:
-
Object
- Object
- BetterLorem::Loader
- Defined in:
- lib/betterlorem.rb
Overview
Lorem file loader
Instance Attribute Summary collapse
-
#lines ⇒ Object
Returns the value of attribute lines.
Instance Method Summary collapse
-
#clean_line(line) ⇒ Object
Remove any bad characters from the line.
-
#initialize ⇒ Loader
constructor
A new instance of Loader.
Constructor Details
#initialize ⇒ Loader
Returns a new instance of Loader.
126 127 128 129 130 131 |
# File 'lib/betterlorem.rb', line 126 def initialize self.lines = [] File.open(File.dirname(__FILE__) << '/lorem.txt').each_line do |line| self.lines << clean_line(line) end end |
Instance Attribute Details
#lines ⇒ Object
Returns the value of attribute lines.
124 125 126 |
# File 'lib/betterlorem.rb', line 124 def lines @lines end |
Instance Method Details
#clean_line(line) ⇒ Object
Remove any bad characters from the line
134 135 136 |
# File 'lib/betterlorem.rb', line 134 def clean_line(line) line.gsub!(/\n/, '') end |