Class: Angus::SDoc::Definitions::GlossaryTerm

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionString

The description of the glossary term.

Returns:

  • (String)

    the current value of description



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

def description
  @description
end

#long_nameString

The long name of the glossary term.

Returns:

  • (String)

    the current value of long_name



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

def long_name
  @long_name
end

#short_nameString

The short name of the glossary term.

Returns:

  • (String)

    the current value of short_name



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

def short_name
  @short_name
end

Class Method Details

.build_from_hash(hash = {}) ⇒ Array<GlossaryTerm>

Initialize multiple GlossaryTerm using the information in the hash parameter.

Parameters:

  • hash (Hash) (defaults to: {})

    The Hash contains GlossaryTerm#short_name as key and other Hash with the other attributes of the GlossaryTerm as a value.

Returns:



16
17
18
19
20
# File 'lib/angus/definitions/glossary_term.rb', line 16

def build_from_hash(hash = {})
  hash.map do |sort_name, gt|
    self.new(sort_name, gt['long_name'], gt['description'])
  end
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.



29
30
31
32
33
# File 'lib/angus/definitions/glossary_term.rb', line 29

def == (other)
  other.kind_of?(Definitions::GlossaryTerm) &&
    self.short_name == other.short_name && self.long_name == other.long_name &&
    self.description == other.description
end