Class: Switch
- Inherits:
-
Object
- Object
- Switch
- Defined in:
- lib/shopifydev/pry/commands.rb
Instance Method Summary collapse
- #current_shop ⇒ Object
- #finish! ⇒ Object
- #finished? ⇒ Boolean
-
#initialize ⇒ Switch
constructor
A new instance of Switch.
- #menu ⇒ Object
- #pick(ix) ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ Switch
Returns a new instance of Switch.
6 7 8 9 |
# File 'lib/shopifydev/pry/commands.rb', line 6 def initialize @current_shop = '' reset! end |
Instance Method Details
#current_shop ⇒ Object
11 12 13 14 |
# File 'lib/shopifydev/pry/commands.rb', line 11 def current_shop @current_shop = ShopifyAPI::Base.site || 'none' TColor.green{ "current shop:"} + " #{@current_shop}" end |
#finish! ⇒ Object
25 26 27 |
# File 'lib/shopifydev/pry/commands.rb', line 25 def finish! @finished = true end |
#finished? ⇒ Boolean
21 22 23 |
# File 'lib/shopifydev/pry/commands.rb', line 21 def finished? @finished end |
#menu ⇒ Object
29 30 31 |
# File 'lib/shopifydev/pry/commands.rb', line 29 def @menu end |
#pick(ix) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/shopifydev/pry/commands.rb', line 33 def pick(ix) result = '' # TODO we need need need to rename cfg, as it is currently confusing @breadcrumbs, @cfg = pick_config(ix) if @breadcrumbs == :no_such_config result << TColor.red{ "I don't know about #{ix}\n" } result << self..print else # update the menu based on the choice # if we've reached a terminal menu, then do something # otherwise just present the next menu result << handle_choice end end |
#reset! ⇒ Object
16 17 18 19 |
# File 'lib/shopifydev/pry/commands.rb', line 16 def reset! @menu = @finished = false end |