Class: ShopifyCLI::Theme::Syncer::Uploader::Forms::BaseStrategyForm

Inherits:
Form
  • Object
show all
Defined in:
lib/shopify_cli/theme/syncer/uploader/forms/base_strategy_form.rb

Direct Known Subclasses

SelectDeleteStrategy, SelectUpdateStrategy

Instance Attribute Summary collapse

Attributes inherited from Form

#ctx, #xargs

Instance Method Summary collapse

Methods inherited from Form

ask, flag_arguments, #initialize, positional_arguments

Constructor Details

This class inherits a constructor from ShopifyCLI::Form

Instance Attribute Details

#strategyObject

Returns the value of attribute strategy.



9
10
11
# File 'lib/shopify_cli/theme/syncer/uploader/forms/base_strategy_form.rb', line 9

def strategy
  @strategy
end

Instance Method Details

#askObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/shopify_cli/theme/syncer/uploader/forms/base_strategy_form.rb', line 11

def ask
  ctx.puts(title_context(file))

  self.strategy = CLI::UI::Prompt.ask(title_question, allow_empty: false) do |handler|
    strategies.each do |strategy|
      handler.option(as_text(strategy)) { strategy }
    end
  end

  exit_cli if self.strategy == :exit

  self
end