class JSON::SchemaGenerator::StatementGroup

Public Class Methods

new(key = nil) click to toggle source
# File lib/json/schema_generator/statement_group.rb, line 4
def initialize key = nil
  @key = key
  @statements = []
end

Public Instance Methods

add(statement) click to toggle source
# File lib/json/schema_generator/statement_group.rb, line 9
def add statement
  @statements << statement
end
to_s() click to toggle source
# File lib/json/schema_generator/statement_group.rb, line 13
def to_s
  buffer = StringIO.new
  if @key.nil?
    buffer.puts "{"
  else 
    buffer.puts "\"#{@key}\": {"
  end
  buffer.puts @statements.join ', '
  buffer.puts "}"
  buffer.string
end