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) ⇒ 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.



30
31
32
33
34
35
36
# File 'lib/angus/definitions/representation_field.rb', line 30

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

Instance Attribute Details

#descriptionString

Returns the description of the representation field.

Returns:

  • (String)

    the description of the representation field.



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

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.



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

def elements_type
  @elements_type
end

#nameString

Returns the name of the representation field.

Returns:

  • (String)

    the name of the representation field.



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

def name
  @name
end

#requiredBoolean

Returns indicates if the representation field is required or not.

Returns:

  • (Boolean)

    indicates if the representation field is required or not.



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

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.



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

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.



43
44
45
46
47
# File 'lib/angus/definitions/representation_field.rb', line 43

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