Class: ColRead::Text
Instance Method Summary collapse
-
#initialize(options = {url: '',output: '', encode: ''}) ⇒ Text
constructor
A new instance of Text.
- #start ⇒ Object
Methods included from Core
#_open, #ahref, #chapters, #contents
Constructor Details
#initialize(options = {url: '',output: '', encode: ''}) ⇒ Text
Returns a new instance of Text.
49 50 51 52 53 54 |
# File 'lib/colread.rb', line 49 def initialize(={url: '',output: '', encode: ''}) @url=[:url] @output=[:output] @encode=[:encode] @root=@url.split(/(?<!\/)\/(?!\/)/).first end |
Instance Method Details
#start ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/colread.rb', line 55 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 |