Class: Article
- Inherits:
-
Object
- Object
- Article
- Defined in:
- lib/link2epub.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#content ⇒ Object
Returns the value of attribute content.
-
#date ⇒ Object
Returns the value of attribute date.
-
#file ⇒ Object
Returns the value of attribute file.
-
#link ⇒ Object
Returns the value of attribute link.
-
#title ⇒ Object
Returns the value of attribute title.
-
#tpl ⇒ Object
Returns the value of attribute tpl.
Instance Method Summary collapse
-
#initialize(link) ⇒ Article
constructor
A new instance of Article.
- #to_file ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(link) ⇒ Article
Returns a new instance of Article.
23 24 25 |
# File 'lib/link2epub.rb', line 23 def initialize(link) @link = link end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
21 22 23 |
# File 'lib/link2epub.rb', line 21 def end |
#content ⇒ Object
Returns the value of attribute content.
21 22 23 |
# File 'lib/link2epub.rb', line 21 def content @content end |
#date ⇒ Object
Returns the value of attribute date.
21 22 23 |
# File 'lib/link2epub.rb', line 21 def date @date end |
#file ⇒ Object
Returns the value of attribute file.
21 22 23 |
# File 'lib/link2epub.rb', line 21 def file @file end |
#link ⇒ Object
Returns the value of attribute link.
21 22 23 |
# File 'lib/link2epub.rb', line 21 def link @link end |
#title ⇒ Object
Returns the value of attribute title.
21 22 23 |
# File 'lib/link2epub.rb', line 21 def title @title end |
#tpl ⇒ Object
Returns the value of attribute tpl.
21 22 23 |
# File 'lib/link2epub.rb', line 21 def tpl @tpl end |
Instance Method Details
#to_file ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/link2epub.rb', line 27 def to_file tpl = File.read(@tpl) eruby = Erubis::Eruby.new(tpl) File.open(@file, 'w') do |f| f.puts eruby.evaluate(self) end end |
#to_s ⇒ Object
36 37 38 39 40 41 |
# File 'lib/link2epub.rb', line 36 def to_s puts "link: #{@link}" puts "title: #{@title}" puts "author: #{@author}" # puts "content: #{@content}" end |