Class: Brew::Commands::Search
- Inherits:
-
Object
- Object
- Brew::Commands::Search
- Defined in:
- lib/brew/commands/search.rb
Instance Attribute Summary collapse
-
#brew_path ⇒ Object
readonly
Returns the value of attribute brew_path.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#search_text ⇒ Object
readonly
Returns the value of attribute search_text.
-
#system_runner ⇒ Object
readonly
Returns the value of attribute system_runner.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(brew_path, search_text = nil, **kwargs) ⇒ Search
constructor
A new instance of Search.
Constructor Details
#initialize(brew_path, search_text = nil, **kwargs) ⇒ Search
Returns a new instance of Search.
11 12 13 14 15 16 |
# File 'lib/brew/commands/search.rb', line 11 def initialize(brew_path, search_text = nil, **kwargs) @brew_path = brew_path @search_text = search_text @options = parse_args(kwargs) @system_runner = SystemRunner.new end |
Instance Attribute Details
#brew_path ⇒ Object (readonly)
Returns the value of attribute brew_path.
9 10 11 |
# File 'lib/brew/commands/search.rb', line 9 def brew_path @brew_path end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/brew/commands/search.rb', line 9 def @options end |
#search_text ⇒ Object (readonly)
Returns the value of attribute search_text.
9 10 11 |
# File 'lib/brew/commands/search.rb', line 9 def search_text @search_text end |
#system_runner ⇒ Object (readonly)
Returns the value of attribute system_runner.
9 10 11 |
# File 'lib/brew/commands/search.rb', line 9 def system_runner @system_runner end |
Instance Method Details
#execute! ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/brew/commands/search.rb', line 18 def execute! search_command = "#{brew_path} search #{} #{search_text}".squish search_output = system_runner.get_output_lines(search_command) organize_search_output(search_output) rescue StandardError => e raise Brew::ExecutionError, e end |