Class: ApipieBindings::Param

Inherits:
Object
  • Object
show all
Defined in:
lib/apipie_bindings/param.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(param) ⇒ Param


7
8
9
10
11
12
13
14
15
16
# File 'lib/apipie_bindings/param.rb', line 7

def initialize(param)
  param = ApipieBindings::IndifferentHash.new(param)
  @name = param[:name]
  params = param[:params] || []
  @params = params.map { |p| ApipieBindings::Param.new(p) }
  @expected_type = param[:expected_type].to_sym
  @description = param[:description].gsub(/<\/?[^>]+?>/, "")
  @required = !!param[:required]
  @validator = param[:validator]
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description


5
6
7
# File 'lib/apipie_bindings/param.rb', line 5

def description
  @description
end

#expected_typeObject (readonly)

Returns the value of attribute expected_type


5
6
7
# File 'lib/apipie_bindings/param.rb', line 5

def expected_type
  @expected_type
end

#nameObject (readonly)

Returns the value of attribute name


5
6
7
# File 'lib/apipie_bindings/param.rb', line 5

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params


5
6
7
# File 'lib/apipie_bindings/param.rb', line 5

def params
  @params
end

#validatorObject (readonly)

Returns the value of attribute validator


5
6
7
# File 'lib/apipie_bindings/param.rb', line 5

def validator
  @validator
end

Instance Method Details

#inspectObject


26
27
28
# File 'lib/apipie_bindings/param.rb', line 26

def inspect
  to_s
end

#required?Boolean


18
19
20
# File 'lib/apipie_bindings/param.rb', line 18

def required?
  @required
end

#to_sObject


22
23
24
# File 'lib/apipie_bindings/param.rb', line 22

def to_s
  "<Param #{ required? ? '*' : '' }#{@name} (#{@expected_type.to_s.capitalize})>"
end