Class: Angus::SDoc::Definitions::RequestElement

Inherits:
Object
  • Object
show all
Defined in:
lib/angus/definitions/request_element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, description = nil, required = nil, type = nil, constraints = nil, valid_values = nil, elements_type = nil, optional = nil) ⇒ RequestElement

Returns a new instance of RequestElement.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/angus/definitions/request_element.rb', line 38

def initialize(name = nil, description = nil, required = nil, type = nil,
               constraints = nil, valid_values = nil, elements_type = nil, optional = nil)
  self.name = name if name
  self.description = description if description
  self.required = required if required
  self.type = type if type
  self.constraints = constraints if constraints
  self.valid_values = valid_values if valid_values
  self.elements_type = elements_type if elements_type
  self.optional = optional if optional
end

Instance Attribute Details

#constraintsArray<String>

Returns the constraints of the request element.

Returns:

  • (Array<String>)

    the constraints of the request element.



23
24
25
# File 'lib/angus/definitions/request_element.rb', line 23

def constraints
  @constraints
end

#descriptionString

Returns the description of the request element.

Returns:

  • (String)

    the description of the request element.



11
12
13
# File 'lib/angus/definitions/request_element.rb', line 11

def description
  @description
end

#elements_typeString

Returns the elements type of the request element.

Returns:

  • (String)

    the elements type of the request element.



31
32
33
# File 'lib/angus/definitions/request_element.rb', line 31

def elements_type
  @elements_type
end

#nameString

Returns the name of the request element.

Returns:

  • (String)

    the name of the request element.



7
8
9
# File 'lib/angus/definitions/request_element.rb', line 7

def name
  @name
end

#optionalBoolean

Returns true if the element is optional.

Returns:

  • (Boolean)

    true if the element is optional



35
36
37
# File 'lib/angus/definitions/request_element.rb', line 35

def optional
  @optional
end

#requiredBoolean

Returns indicates if the request element is required or not.

Returns:

  • (Boolean)

    indicates if the request element is required or not.



15
16
17
# File 'lib/angus/definitions/request_element.rb', line 15

def required
  @required
end

#typeString

Returns the type of the request element.

Returns:

  • (String)

    the type of the request element.



19
20
21
# File 'lib/angus/definitions/request_element.rb', line 19

def type
  @type
end

#valid_valuesArray<String>

Returns the valid values of the request element.

Returns:

  • (Array<String>)

    the valid values of the request element.



27
28
29
# File 'lib/angus/definitions/request_element.rb', line 27

def valid_values
  @valid_values
end

Instance Method Details

#==(other) ⇒ Boolean

Check if an object is equals to the current instance.

Parameters:

Returns:

  • (Boolean)

    true if all the attributes are equal and false otherwise.



55
56
57
58
59
60
61
62
# File 'lib/angus/definitions/request_element.rb', line 55

def ==(other)
  other.instance_of?(Definitions::RequestElement) &&
    name == other.name && description == other.description &&
    required == other.required && type == other.type &&
    constraints == other.constraints &&
    valid_values == other.valid_values &&
    elements_type == other.elements_type && optional == other.optional
end