Class: DayOne2MD::Converter
- Inherits:
-
Object
- Object
- DayOne2MD::Converter
- Defined in:
- lib/dayone2md/converter.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Converter
constructor
A new instance of Converter.
- #run ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Converter
Returns a new instance of Converter.
5 6 7 |
# File 'lib/dayone2md/converter.rb', line 5 def initialize(opts={}) @opts = opts end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
3 4 5 |
# File 'lib/dayone2md/converter.rb', line 3 def opts @opts end |
Instance Method Details
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dayone2md/converter.rb', line 9 def run DayOneEntry.all(opts[:input]).each do |entry| MarkdownEntry.new( date: entry.date, title: entry.title, content: entry.content, dir: opts[:output] ).save end end |