Class: Useless::Doc::DSL::Body

Inherits:
Object
  • Object
show all
Includes:
Member
Defined in:
lib/useless/doc/dsl.rb

Instance Method Summary collapse

Methods included from Member

#generate, included, #initialize

Instance Method Details

#attribute(key, description, attributes = {}, &block) ⇒ Object



328
329
330
331
332
333
334
# File 'lib/useless/doc/dsl.rb', line 328

def attribute(key, description, attributes = {}, &block)
  subbody = Body.build({}, &block)
  attribute = Doc::Core::Body::Attribute.new attributes.merge(
    key: key, description: description, attributes: subbody.attributes
  )
  @attributes[:attributes] << attribute
end

#content_type(value) ⇒ Object



324
325
326
# File 'lib/useless/doc/dsl.rb', line 324

def content_type(value)
  @attributes[:content_type] = value
end

#default_attributesObject



320
321
322
# File 'lib/useless/doc/dsl.rb', line 320

def default_attributes
  { attributes: [] }
end