Class: ColRead::Text
Instance Method Summary collapse
-
#initialize(options = {url: '',output: ''}) ⇒ Text
constructor
A new instance of Text.
- #start ⇒ Object
Methods included from Core
Constructor Details
#initialize(options = {url: '',output: ''}) ⇒ Text
Returns a new instance of Text.
34 35 36 37 38 |
# File 'lib/colread.rb', line 34 def initialize(={url: '',output: ''}) @url=[:url] @output=[:output] @root=@url.split(/(?<!\/)\/(?!\/)/).first end |
Instance Method Details
#start ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/colread.rb', line 39 def start f=open(@output,'w') contents(chapters(@url)) do |c| puts c.first f.puts c.first f.puts c.last end f.close end |