Class: ADN::CLI::TerminalStream
- Inherits:
-
Object
- Object
- ADN::CLI::TerminalStream
show all
- Includes:
- ANSI::Code, ANSI::Terminal
- Defined in:
- lib/adn/cli/terminal_stream.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of TerminalStream.
18
19
20
|
# File 'lib/adn/cli/terminal_stream.rb', line 18
def initialize(user)
@user = user
end
|
Class Method Details
.start ⇒ Object
11
12
13
14
15
16
|
# File 'lib/adn/cli/terminal_stream.rb', line 11
def self.start
stream = new(ADN::User.me)
loop { stream.show sleep: 4 }
rescue SocketError
exit
end
|
Instance Method Details
#get_stream ⇒ Object
32
33
34
|
# File 'lib/adn/cli/terminal_stream.rb', line 32
def get_stream
raise NoMethodError, "Should be implemented by child class"
end
|
#show(options) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/adn/cli/terminal_stream.rb', line 23
def show(options)
get_stream.tap do |r|
show_posts(r)
update_since_id(r)
end
sleep options[:sleep]
end
|