Class: MeteoPl::Utility::Presenter

Inherits:
Object
  • Object
show all
Defined in:
lib/meteo_pl/utility/presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(net_fetcher, file_handler, file_opener, graph) ⇒ Presenter

Returns a new instance of Presenter.



4
5
6
7
8
9
# File 'lib/meteo_pl/utility/presenter.rb', line 4

def initialize(net_fetcher, file_handler, file_opener, graph)
  @net_fetcher = net_fetcher
  @file_handler = file_handler
  @file_opener = file_opener
  @graph = graph
end

Instance Method Details

#showObject



11
12
13
14
15
16
17
18
# File 'lib/meteo_pl/utility/presenter.rb', line 11

def show
  file_handler.open do |temp_file|
    graph_content = net_fetcher.fetch(graph.uri, &:body)
    temp_file.write(graph_content)
    file_opener.path = temp_file.path
    file_opener.open
  end
end