Class: ConfigMenu

Inherits:
Object
  • Object
show all
Defined in:
lib/shopifydev/pry/commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json, style = :default) ⇒ ConfigMenu

Returns a new instance of ConfigMenu.



238
239
240
241
242
243
# File 'lib/shopifydev/pry/commands.rb', line 238

def initialize(json, style=:default)
  @json = json
  @style = style
  @choices = [:do_nothing]
  @lines = []
end

Instance Attribute Details

#jsonObject

Returns the value of attribute json.



236
237
238
# File 'lib/shopifydev/pry/commands.rb', line 236

def json
  @json
end

Instance Method Details

#buildObject



245
246
247
248
249
250
251
252
# File 'lib/shopifydev/pry/commands.rb', line 245

def build
  case @style
  when :development then build_development
  when :default then build_default
  when :heroku then build_heroku
  else build_missing
  end
end

#pick(ix) ⇒ Object



262
263
264
265
266
267
268
# File 'lib/shopifydev/pry/commands.rb', line 262

def pick(ix)
  if ix >= @choices.length
    nil
  else
    @choices[ix]
  end
end


254
255
256
257
258
259
260
# File 'lib/shopifydev/pry/commands.rb', line 254

def print(output=nil)
  if output.nil?
    @lines.join("\n")
  else
    output.puts @lines.join("\n")
  end
end