Class: NewsFetcher::Command
- Inherits:
-
Simple::CommandParser::Command
- Object
- Simple::CommandParser::Command
- NewsFetcher::Command
- Defined in:
- lib/newsfetcher/command.rb
Direct Known Subclasses
NewsFetcher::Commands::Add, NewsFetcher::Commands::Dir, NewsFetcher::Commands::Disable, NewsFetcher::Commands::Discover, NewsFetcher::Commands::Edit, NewsFetcher::Commands::Enable, NewsFetcher::Commands::Fix, NewsFetcher::Commands::Get, NewsFetcher::Commands::Init, NewsFetcher::Commands::Remove, NewsFetcher::Commands::Reset, NewsFetcher::Commands::Show, NewsFetcher::Commands::Update
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#max_threads ⇒ Object
Returns the value of attribute max_threads.
Instance Method Summary collapse
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
5 6 7 |
# File 'lib/newsfetcher/command.rb', line 5 def dir @dir end |
#log_level ⇒ Object
Returns the value of attribute log_level.
6 7 8 |
# File 'lib/newsfetcher/command.rb', line 6 def log_level @log_level end |
#max_threads ⇒ Object
Returns the value of attribute max_threads.
7 8 9 |
# File 'lib/newsfetcher/command.rb', line 7 def max_threads @max_threads end |
Instance Method Details
#run(args) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/newsfetcher/command.rb', line 9 def run(args) dir = Path.new(@dir || DefaultProfileDir) config_file = dir / ConfigFileName config = config_file.exist? ? BaseConfig.load(config_file) : BaseConfig.make config.log_level = @log_level.downcase.to_sym if @log_level config.max_threads = @max_threads&.to_i if @max_threads @profile = Profile.new(dir: dir, config: config) or raise Error, "Profile not loaded" end |