Class: NDFRT::Concept
- Inherits:
-
Object
- Object
- NDFRT::Concept
- Defined in:
- lib/ndfrt/concept.rb
Instance Attribute Summary collapse
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nui ⇒ Object
Returns the value of attribute nui.
Instance Method Summary collapse
- #==(concept) ⇒ Object
- #extended_information ⇒ Object (also: #extended_info)
-
#initialize(concept_hash) ⇒ Concept
constructor
A new instance of Concept.
- #to_s ⇒ Object
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
#kind ⇒ Object
Returns the value of attribute kind.
3 4 5 |
# File 'lib/ndfrt/concept.rb', line 3 def kind @kind end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/ndfrt/concept.rb', line 3 def name @name end |
#nui ⇒ Object
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_information ⇒ Object 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_s ⇒ Object
14 15 16 |
# File 'lib/ndfrt/concept.rb', line 14 def to_s name end |