Class: Mako::SubscriptionListWriter

Inherits:
Object
  • Object
show all
Includes:
FileOpenUtil
Defined in:
lib/mako/subscription_list_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileOpenUtil

included, #load_resource

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

#destinationObject (readonly)

Returns the value of attribute destination.



7
8
9
# File 'lib/mako/subscription_list_writer.rb', line 7

def destination
  @destination
end

#feedsObject (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_writeObject

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