Class: Swaggable::ParameterDefinition

Inherits:
Object
  • Object
show all
Includes:
DefinitionBase
Defined in:
lib/swaggable/parameter_definition.rb

Instance Method Summary collapse

Methods included from DefinitionBase

included, #initialize

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



34
35
36
37
38
39
40
# File 'lib/swaggable/parameter_definition.rb', line 34

def == other
  if other.respond_to?(:name) && other.respond_to?(:location)
    [name, location] == [other.name, other.location]
  else
    false
  end
end

#hashObject



44
45
46
# File 'lib/swaggable/parameter_definition.rb', line 44

def hash
  [name, location].hash
end

#name=(value) ⇒ Object



30
31
32
# File 'lib/swaggable/parameter_definition.rb', line 30

def name= value
  @name = value.to_s
end

#required?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/swaggable/parameter_definition.rb', line 19

def required?
  !!required
end

#schema(&block) ⇒ Object



23
24
25
26
27
28
# File 'lib/swaggable/parameter_definition.rb', line 23

def schema &block
  ForwardingDsl.run(
    @schema ||= build_schema,
    &block
  )
end