Class: Twterm::Tweetbox
- Inherits:
-
Object
show all
- Includes:
- Curses, Readline, Publisher
- Defined in:
- lib/twterm/tweetbox.rb
Defined Under Namespace
Classes: EmptyTextError, TextTooLongError
Instance Method Summary
collapse
Methods included from Publisher
#publish
Methods included from Utils
check_type
Constructor Details
#initialize(app, client) ⇒ Tweetbox
Returns a new instance of Tweetbox.
22
23
24
|
# File 'lib/twterm/tweetbox.rb', line 22
def initialize(app, client)
@app, @client = app, client
end
|
Instance Method Details
#compose ⇒ Object
26
27
28
|
# File 'lib/twterm/tweetbox.rb', line 26
def compose
ask_and_post("\e[1mCompose new Tweet\e[0m", '> ', -> body { body })
end
|
#quote(status) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/twterm/tweetbox.rb', line 30
def quote(status)
screen_name = app.user_repository.find(status.user_id).screen_name
leading_text = "\e[1mQuoting @#{screen_name}'s Tweet\e[0m\n\n#{status.text}"
prompt = '> '
ask_and_post(leading_text, prompt, -> body { "#{body} #{status.url}" })
end
|
#reply(status) ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/twterm/tweetbox.rb', line 38
def reply(status)
screen_name = app.user_repository.find(status.user_id).screen_name
leading_text = "\e[1mReplying to @#{screen_name}\e[0m\n\n#{status.text}"
prompt = { prompt: '> ', init_text: "@#{screen_name} " }
ask_and_post(leading_text, prompt, -> body { body }, { in_reply_to_status_id: status.id })
end
|