Class: Birdwatcher::Command
- Inherits:
-
Object
- Object
- Birdwatcher::Command
- Includes:
- Birdwatcher::Concerns::Concurrency, Birdwatcher::Concerns::Core, Birdwatcher::Concerns::Outputting, Birdwatcher::Concerns::Persistence, Birdwatcher::Concerns::Presentation, Birdwatcher::Concerns::Util
- Defined in:
- lib/birdwatcher/command.rb
Direct Known Subclasses
Birdwatcher::Commands::Back, Birdwatcher::Commands::Exit, Birdwatcher::Commands::Help, Birdwatcher::Commands::Irb, Birdwatcher::Commands::Module, Birdwatcher::Commands::Query, Birdwatcher::Commands::QueryCsv, Birdwatcher::Commands::Resource, Birdwatcher::Commands::Run, Birdwatcher::Commands::Schema, Birdwatcher::Commands::Set, Birdwatcher::Commands::Shell, Birdwatcher::Commands::Show, Birdwatcher::Commands::Spool, Birdwatcher::Commands::Status, Birdwatcher::Commands::Unset, Birdwatcher::Commands::Use, Birdwatcher::Commands::User, Birdwatcher::Commands::Workspace
Defined Under Namespace
Classes: Error, InvalidMetadataError, MetadataNotSetError
Constant Summary collapse
- ARGUMENT_SEPARATOR =
" ".freeze
Constants included from Birdwatcher::Concerns::Concurrency
Birdwatcher::Concerns::Concurrency::DEFAULT_THREAD_POOL_SIZE
Constants included from Birdwatcher::Concerns::Core
Birdwatcher::Concerns::Core::DATA_DIRECTORY
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
Class Method Summary collapse
- .auto_completion ⇒ Object
- .auto_completion_strings ⇒ Object
- .descendants ⇒ Object
- .detailed_usage ⇒ Object
- .has_name?(name) ⇒ Boolean
- .meta ⇒ Object
- .meta=(meta) ⇒ Object
Instance Method Summary collapse
Methods included from Birdwatcher::Concerns::Concurrency
Methods included from Birdwatcher::Concerns::Persistence
included, #save_status, #save_user
Methods included from Birdwatcher::Concerns::Presentation
included, #make_status_summary_output, #make_url_summary_output, #make_user_details_output, #make_user_summary_output, #output_status_summary, #output_user_details, #output_user_summary, #page_text
Methods included from Birdwatcher::Concerns::Outputting
#confirm, #error, #fatal, included, #info, #line_separator, #newline, #output, #output_formatted, #task, #warn
Methods included from Birdwatcher::Concerns::Util
#escape_html, #excerpt, included, #number_to_human_size, #parse_time, #pluralize, #strip_control_characters, #strip_html, #suppress_output, #suppress_warnings, #time_ago_in_words, #unescape_html
Methods included from Birdwatcher::Concerns::Core
#console, #current_workspace, #current_workspace=, #database, included, #klout_client, #read_data_file, #twitter_client
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
9 10 11 |
# File 'lib/birdwatcher/command.rb', line 9 def arguments @arguments end |
Class Method Details
.auto_completion ⇒ Object
41 42 43 |
# File 'lib/birdwatcher/command.rb', line 41 def self.auto_completion [] end |
.auto_completion_strings ⇒ Object
37 38 39 |
# File 'lib/birdwatcher/command.rb', line 37 def self.auto_completion_strings ([:names] + auto_completion).uniq end |
.descendants ⇒ Object
29 30 31 |
# File 'lib/birdwatcher/command.rb', line 29 def self.descendants ObjectSpace.each_object(Class).select { |klass| klass < self } end |
.detailed_usage ⇒ Object
27 |
# File 'lib/birdwatcher/command.rb', line 27 def self.detailed_usage; end |
.has_name?(name) ⇒ Boolean
33 34 35 |
# File 'lib/birdwatcher/command.rb', line 33 def self.has_name?(name) [:names].include?(name) end |
.meta ⇒ Object
18 19 20 |
# File 'lib/birdwatcher/command.rb', line 18 def self. @meta || fail(MetadataNotSetError, "Metadata has not been set") end |
.meta=(meta) ⇒ Object
22 23 24 25 |
# File 'lib/birdwatcher/command.rb', line 22 def self.() () @meta = end |
Instance Method Details
#execute(argument_line) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/birdwatcher/command.rb', line 45 def execute(argument_line) @arguments = argument_line.to_s.split(ARGUMENT_SEPARATOR).map { |a| a.to_s.strip } run rescue => e error("#{e.class}".bold + ": #{e.}") puts e.backtrace.join("\n") end |