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.



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

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

Instance Attribute Details

#jsonObject

Returns the value of attribute json.



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

def json
  @json
end

Instance Method Details

#buildObject



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

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



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

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


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

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