Class: BetterLorem::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/betterlorem.rb

Overview

Lorem file loader

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLoader

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

#linesObject

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