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: #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
51 52 53 54 55 56 |
# File 'lib/myun2/twitter_shell/shell.rb', line 51 def login(*params) Login.new(*params) @profile = Profile.load @client = Client.new(@profile.data) end |
#ls(*params) ⇒ Object
33 34 35 |
# File 'lib/myun2/twitter_shell/shell.rb', line 33 def ls(*params) Ls.new(client, *params) end |
#prompt ⇒ Object
47 48 49 |
# File 'lib/myun2/twitter_shell/shell.rb', line 47 def prompt "twsh:$ " end |
#tail(*params) ⇒ Object
37 38 39 40 41 |
# File 'lib/myun2/twitter_shell/shell.rb', line 37 def tail(*params) #ls(*params) puts "Waiting for timelime..." Tail.new(@profile.data, *params) end |
#tweet(*params) ⇒ Object Also known as: post, update
27 28 29 |
# File 'lib/myun2/twitter_shell/shell.rb', line 27 def tweet(*params) client.update params.join(" ") end |
#version ⇒ Object
43 44 45 |
# File 'lib/myun2/twitter_shell/shell.rb', line 43 def version puts "twsh #{VERSION}" end |