Class: TypeSpecFromSerializers::Resource

Inherits:
Struct
  • Object
show all
Defined in:
lib/typespec_from_serializers/generator.rb

Overview

Internal: Represents a TypeSpec resource interface

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



222
223
224
# File 'lib/typespec_from_serializers/generator.rb', line 222

def name
  @name
end

#operationsObject

Returns the value of attribute operations

Returns:

  • (Object)

    the current value of operations



222
223
224
# File 'lib/typespec_from_serializers/generator.rb', line 222

def operations
  @operations
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



222
223
224
# File 'lib/typespec_from_serializers/generator.rb', line 222

def path
  @path
end

Instance Method Details

#as_typespecObject



223
224
225
226
227
228
229
230
# File 'lib/typespec_from_serializers/generator.rb', line 223

def as_typespec
  <<~TSP
    #{"  " * 1}@route("#{path}")
    #{"  " * 1}interface #{name} {
    #{"  " * 1}#{operations.map(&:as_typespec).join("\n  ")}
    #{"  " * 1}}
  TSP
end