class Rspec::Usecases::Generator::JsonGenerator

JSON Generator

Attributes

data[R]

Public Instance Methods

generate() click to toggle source
# File lib/rspec/usecases/generator/json_generator.rb, line 25
def generate
  @data = {
    document: {
      title: document.title,
      description: document.description
    },
    usecases: document.groups.map(&:to_h)
  }

  @output = JSON.pretty_generate(@data)
end
run() click to toggle source
# File lib/rspec/usecases/generator/json_generator.rb, line 13
def run
  generate

  print_output if options.printable?

  return unless options.writable?

  write_file(options.file)

  open_file_in_vscode(options.file) if options.openable?
end