Module: TinyNews
- Defined in:
- lib/tinynews.rb,
lib/tinynews/feed.rb,
lib/tinynews/feeds.rb,
lib/tinynews/sources.rb,
lib/tinynews/version.rb,
lib/tinynews/cli_printer.rb,
lib/tinynews/json_exporter.rb
Defined Under Namespace
Classes: CLIPrinter, Feed, Feeds, JSONExporter
Constant Summary
collapse
- VERSION =
"1.0.3"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.feed_as_json(feed_symbol) ⇒ Object
12
13
14
|
# File 'lib/tinynews.rb', line 12
def self.feed_as_json feed_symbol
JSONExporter.export( get_feed(feed_symbol) )
end
|
.get_feed(feed_symbol) ⇒ Object
8
9
10
|
# File 'lib/tinynews.rb', line 8
def self.get_feed feed_symbol
Feeds.new.generate( feed_symbol )
end
|
.print_to_cli(feed_symbol) ⇒ Object
16
17
18
|
# File 'lib/tinynews.rb', line 16
def self.print_to_cli feed_symbol
CLIPrinter.print( get_feed(feed_symbol) )
end
|
.say_hello ⇒ Object
20
21
22
|
# File 'lib/tinynews.rb', line 20
def self.say_hello
puts "Hello"
end
|
.sources_from_home ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/tinynews.rb', line 24
def self.sources_from_home
source_file = File.expand_path('~/.tinynews.yml')
unless File.file?( source_file )
File.open( source_file, "w") do |f|
f.write( File.open("../sources.yml", "r").read )
end
end
f = open(source_file, "r").read
YAML::load( f )
end
|
Instance Method Details
#sources_from_home ⇒ Object
3
4
5
6
|
# File 'lib/tinynews/sources.rb', line 3
def sources_from_home
f = open(File.expand_path('~/.tinynews.yml')).read
YAML::load( f )
end
|