Class: Useless::Doc::Core::Body::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/useless/doc/core/body.rb

Overview

Documentation for an attribute on an HTTP body.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Attribute



49
50
51
52
53
54
55
# File 'lib/useless/doc/core/body.rb', line 49

def initialize(attrs)
  @key          = attrs[:key]
  @type         = attrs[:type] || 'string'
  @required     = attrs.key?(:required) ? attrs[:required] : true
  @default      = attrs[:default]
  @description  = attrs[:description]
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



45
46
47
# File 'lib/useless/doc/core/body.rb', line 45

def default
  @default
end

#descriptionString (readonly)



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/useless/doc/core/body.rb', line 43

class Attribute

  attr_reader :key, :type, :required, :default, :description

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs)
    @key          = attrs[:key]
    @type         = attrs[:type] || 'string'
    @required     = attrs.key?(:required) ? attrs[:required] : true
    @default      = attrs[:default]
    @description  = attrs[:description]
  end
end

#keyString (readonly)



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/useless/doc/core/body.rb', line 43

class Attribute

  attr_reader :key, :type, :required, :default, :description

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs)
    @key          = attrs[:key]
    @type         = attrs[:type] || 'string'
    @required     = attrs.key?(:required) ? attrs[:required] : true
    @default      = attrs[:default]
    @description  = attrs[:description]
  end
end

#requiredBoolean (readonly)



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/useless/doc/core/body.rb', line 43

class Attribute

  attr_reader :key, :type, :required, :default, :description

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs)
    @key          = attrs[:key]
    @type         = attrs[:type] || 'string'
    @required     = attrs.key?(:required) ? attrs[:required] : true
    @default      = attrs[:default]
    @description  = attrs[:description]
  end
end

#typeObject (readonly)

Returns the value of attribute type.



45
46
47
# File 'lib/useless/doc/core/body.rb', line 45

def type
  @type
end

#value_typeString (readonly)



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/useless/doc/core/body.rb', line 43

class Attribute

  attr_reader :key, :type, :required, :default, :description

  # @param [Hash] attrs corresponds to the class's instance attributes.
  #
  def initialize(attrs)
    @key          = attrs[:key]
    @type         = attrs[:type] || 'string'
    @required     = attrs.key?(:required) ? attrs[:required] : true
    @default      = attrs[:default]
    @description  = attrs[:description]
  end
end