Class: NDFRT::Concept

Inherits:
Object
  • Object
show all
Defined in:
lib/ndfrt/concept.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(concept_hash) ⇒ Concept

Returns a new instance of Concept.



5
6
7
8
9
10
11
12
# File 'lib/ndfrt/concept.rb', line 5

def initialize concept_hash
  unless [:concept_name, :concept_nui, :concept_kind].all? { |k| concept_hash.has_key? k }
    raise ArgumentError, "You must supply a hash with the conecept's name, nui and kind"
  end
  @name = concept_hash[:concept_name].capitalize
  @nui  = concept_hash[:concept_nui]
  @kind = titleize_kind concept_hash[:concept_kind]
end

Instance Attribute Details

#kindObject

Returns the value of attribute kind.



3
4
5
# File 'lib/ndfrt/concept.rb', line 3

def kind
  @kind
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/ndfrt/concept.rb', line 3

def name
  @name
end

#nuiObject

Returns the value of attribute nui.



3
4
5
# File 'lib/ndfrt/concept.rb', line 3

def nui
  @nui
end

Instance Method Details

#==(concept) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/ndfrt/concept.rb', line 18

def == concept
  self.instance_variables.each do |i|
    equal = (self.instance_variable_get(i) == concept.instance_variable_get(i))
    return equal if !equal
  end
  true
end

#extended_informationObject Also known as: extended_info



26
27
28
# File 'lib/ndfrt/concept.rb', line 26

def extended_information
  NDFRT.new.get_info self.nui
end

#to_sObject



14
15
16
# File 'lib/ndfrt/concept.rb', line 14

def to_s
  name
end