Class: Feedcellar::Curses::Command
- Inherits:
-
Thor
- Object
- Thor
- Feedcellar::Curses::Command
- Defined in:
- lib/feedcellar/curses/command.rb
Instance Attribute Summary collapse
-
#database_dir ⇒ Object
readonly
Returns the value of attribute database_dir.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Command
constructor
A new instance of Command.
- #search(*words) ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(*args) ⇒ Command
Returns a new instance of Command.
30 31 32 33 34 35 |
# File 'lib/feedcellar/curses/command.rb', line 30 def initialize(*args) super default_base_dir = File.join(File.("~"), ".feedcellar") @base_dir = ENV["FEEDCELLAR_HOME"] || default_base_dir @database_dir = File.join(@base_dir, "db") end |
Instance Attribute Details
#database_dir ⇒ Object (readonly)
Returns the value of attribute database_dir.
28 29 30 |
# File 'lib/feedcellar/curses/command.rb', line 28 def database_dir @database_dir end |
Instance Method Details
#search(*words) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/feedcellar/curses/command.rb', line 49 def search(*words) if words.empty? && (["resource"].nil? || ["resource"].empty?) $stderr.puts "WARNING: required one of word or resource option." return 1 end GroongaDatabase.new.open(@database_dir) do |database| sorted_feeds = GroongaSearcher.search(database, words, ) View.run(sorted_feeds) end end |
#version ⇒ Object
38 39 40 |
# File 'lib/feedcellar/curses/command.rb', line 38 def version puts VERSION end |