Class: Myun2::TwitterShell::Shell
- Inherits:
-
ShellBase
- Object
- ShellBase
- Myun2::TwitterShell::Shell
- Defined in:
- lib/myun2/twitter_shell/shell.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(*params) ⇒ Shell
constructor
A new instance of Shell.
- #login(*params) ⇒ Object
- #ls(*params) ⇒ Object
- #prompt ⇒ Object
- #tail(*params) ⇒ Object
- #tweet(*params) ⇒ Object (also: #p, #t, #post, #update)
- #version ⇒ Object
Constructor Details
#initialize(*params) ⇒ Shell
Returns a new instance of Shell.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/myun2/twitter_shell/shell.rb', line 13 def initialize(*params) if @profile = Profile.load @client = Client.new(@profile.data) if params && params.length > 0 return self.send(*params) end else puts "Please first login" end version super end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
11 12 13 |
# File 'lib/myun2/twitter_shell/shell.rb', line 11 def client @client end |
Instance Method Details
#login(*params) ⇒ Object
60 61 62 63 64 65 |
# File 'lib/myun2/twitter_shell/shell.rb', line 60 def login(*params) Login.new(*params) @profile = Profile.load @client = Client.new(@profile.data) end |
#ls(*params) ⇒ Object
36 37 38 |
# File 'lib/myun2/twitter_shell/shell.rb', line 36 def ls(*params) Ls.new(client, *params) end |
#prompt ⇒ Object
56 57 58 |
# File 'lib/myun2/twitter_shell/shell.rb', line 56 def prompt "twsh:$ " end |
#tail(*params) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/myun2/twitter_shell/shell.rb', line 40 def tail(*params) #ls(*params) puts "Waiting for timelime..." if params[0] == '&' @tail_thread = Thread.start do Tail.new(@profile.data, *params) end else Tail.new(@profile.data, *params) end end |
#tweet(*params) ⇒ Object Also known as: p, t, post, update
27 28 29 30 |
# File 'lib/myun2/twitter_shell/shell.rb', line 27 def tweet(*params) client.update params.join(" ") puts "Post was successfully." end |
#version ⇒ Object
52 53 54 |
# File 'lib/myun2/twitter_shell/shell.rb', line 52 def version puts "twsh #{VERSION}" end |