Class: RspecApiDocs::Resource::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_api_docs/formatter/resource/parameter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, parameter) ⇒ Parameter

Returns a new instance of Parameter.



6
7
8
9
# File 'lib/rspec_api_docs/formatter/resource/parameter.rb', line 6

def initialize(name, parameter)
  @name = name
  @parameter = parameter
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/rspec_api_docs/formatter/resource/parameter.rb', line 4

def name
  @name
end

#parameterObject (readonly)

Returns the value of attribute parameter.



4
5
6
# File 'lib/rspec_api_docs/formatter/resource/parameter.rb', line 4

def parameter
  @parameter
end

Instance Method Details

#==(other) ⇒ true, false

Returns:

  • (true, false)


33
34
35
36
# File 'lib/rspec_api_docs/formatter/resource/parameter.rb', line 33

def ==(other)
  name == other.name &&
    parameter == other.parameter
end

#descriptionString

The description of the parameter

Returns:

  • (String)


28
29
30
# File 'lib/rspec_api_docs/formatter/resource/parameter.rb', line 28

def description
  parameter[:description]
end

#requiredString

If the parameter is required

Returns:

  • (String)


21
22
23
# File 'lib/rspec_api_docs/formatter/resource/parameter.rb', line 21

def required
  !!parameter[:required]
end

#scopeArray<String>

The scope of the parameter

Returns:

  • (Array<String>)


14
15
16
# File 'lib/rspec_api_docs/formatter/resource/parameter.rb', line 14

def scope
  parameter[:scope]
end

#typeString?

Returns:

  • (String, nil)


39
40
41
# File 'lib/rspec_api_docs/formatter/resource/parameter.rb', line 39

def type
  parameter[:type]
end