class Dry::Doc::Object
Attributes
ref[RW]
Public Class Methods
as_open_api()
click to toggle source
# File lib/dry/doc/object.rb, line 13 def as_open_api doc.as_json end
attribute(name, type=nil, opts={})
click to toggle source
Calls superclass method
# File lib/dry/doc/object.rb, line 21 def attribute name, type=nil, opts={}, &nested if nested opts = type || {} inline_class = build_type :"#{self.name}::#{name}", &nested ::Dry::Doc.inline inline_class type = types.instance inline_class type = type.optional if opts[:optional] end doc.register name, type, description: opts.delete(:description) super name, type end
doc()
click to toggle source
# File lib/dry/doc/object.rb, line 5 def doc @_doc ||= ::Dry::Doc::Schema.new self end
inspect()
click to toggle source
# File lib/dry/doc/object.rb, line 35 def inspect "<#{name}>" end
name()
click to toggle source
# File lib/dry/doc/object.rb, line 17 def name ref end
types()
click to toggle source
# File lib/dry/doc/object.rb, line 9 def types ::Dry::Doc::Types end
Private Class Methods
build_type(name, &config)
click to toggle source
# File lib/dry/doc/object.rb, line 41 def build_type name, &config Class.new ::Dry::Doc::Object do |klass| class_exec &config define_singleton_method(:name) { name } end end
Public Instance Methods
as_json(*_)
click to toggle source
# File lib/dry/doc/object.rb, line 49 def as_json *_ to_h end