Class: Angus::SDoc::Definitions::RepresentationField

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, description = nil, required = nil, type = nil, elements_type = nil, optional = nil) ⇒ RepresentationField

Note:

if the elements_type attribute is different from nil, it means that the representation field is a list of objects. In that case, the type parameter is not considered.

Returns a new instance of RepresentationField.



33
34
35
36
37
38
39
40
41
# File 'lib/angus/definitions/representation_field.rb', line 33

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

Instance Attribute Details

#descriptionString

Returns the description of the representation field.

Returns:

  • (String)

    the description of the representation field.



10
11
12
# File 'lib/angus/definitions/representation_field.rb', line 10

def description
  @description
end

#elements_typeString

Returns the elements type of the representation field. This attribute is used when the representation is a list of objects.

Returns:

  • (String)

    the elements type of the representation field. This attribute is used when the representation is a list of objects.



24
25
26
# File 'lib/angus/definitions/representation_field.rb', line 24

def elements_type
  @elements_type
end

#nameString

Returns the name of the representation field.

Returns:

  • (String)

    the name of the representation field.



6
7
8
# File 'lib/angus/definitions/representation_field.rb', line 6

def name
  @name
end

#optionalBoolean

Returns true if the element is optional.

Returns:

  • (Boolean)

    true if the element is optional



28
29
30
# File 'lib/angus/definitions/representation_field.rb', line 28

def optional
  @optional
end

#requiredBoolean

Returns indicates if the representation field is required or not.

Returns:

  • (Boolean)

    indicates if the representation field is required or not.



14
15
16
# File 'lib/angus/definitions/representation_field.rb', line 14

def required
  @required
end

#typeString

Returns the type of the representation field. This attribute is used when the representation is a single object.

Returns:

  • (String)

    the type of the representation field. This attribute is used when the representation is a single object.



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

def type
  @type
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.



48
49
50
51
52
53
# File 'lib/angus/definitions/representation_field.rb', line 48

def ==(other)
  other.kind_of?(Definitions::RepresentationField) &&
    name == other.name && description == other.description &&
    required == other.required && type == other.type &&
    elements_type == other.elements_type && optional == other.optional
end