Class: Mako::SubscriptionListWriter
- Inherits:
-
Object
- Object
- Mako::SubscriptionListWriter
- Includes:
- FileOpenUtil
- Defined in:
- lib/mako/subscription_list_writer.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#feeds ⇒ Object
readonly
Returns the value of attribute feeds.
Instance Method Summary collapse
-
#append_and_write ⇒ Object
Appends the new subscriptions to the subscription list and writes the results out to the file.
-
#initialize(args) ⇒ SubscriptionListWriter
constructor
A new instance of SubscriptionListWriter.
Methods included from FileOpenUtil
Constructor Details
#initialize(args) ⇒ SubscriptionListWriter
Returns a new instance of SubscriptionListWriter.
9 10 11 12 |
# File 'lib/mako/subscription_list_writer.rb', line 9 def initialize(args) @feeds = args.fetch(:feeds) @destination = args.fetch(:destination) end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
7 8 9 |
# File 'lib/mako/subscription_list_writer.rb', line 7 def destination @destination end |
#feeds ⇒ Object (readonly)
Returns the value of attribute feeds.
7 8 9 |
# File 'lib/mako/subscription_list_writer.rb', line 7 def feeds @feeds end |
Instance Method Details
#append_and_write ⇒ Object
Appends the new subscriptions to the subscription list and writes the results out to the file.
16 17 18 19 20 21 |
# File 'lib/mako/subscription_list_writer.rb', line 16 def append_and_write contents = append_and_render File.open(destination, 'w+', encoding: 'utf-8') do |f| f.write(contents) end end |