Class: Desmoservice::Sector
Instance Attribute Summary collapse
-
#members ⇒ Object
readonly
Returns the value of attribute members.
-
#subsectors ⇒ Object
readonly
Returns the value of attribute subsectors.
Attributes inherited from Term
#attrs, #color, #id, #localkey, #parent_id, #parent_localkey, #text
Instance Method Summary collapse
- #get_subsector_by_id(id) ⇒ Object
-
#initialize(data) ⇒ Sector
constructor
A new instance of Sector.
Methods inherited from Term
#[], #color?, #has_attr?, #localkey?, #text?
Constructor Details
#initialize(data) ⇒ Sector
Returns a new instance of Sector.
7 8 9 10 11 12 13 14 |
# File 'lib/sector.rb', line 7 def initialize(data) super(data['terme']) @subsectors = Array.new @members = Array.new if data.has_key?('liaisonArray') data['liaisonArray'].each {|v| @members << SectorTerm.new(v)} end end |
Instance Attribute Details
#members ⇒ Object (readonly)
Returns the value of attribute members.
5 6 7 |
# File 'lib/sector.rb', line 5 def members @members end |
#subsectors ⇒ Object (readonly)
Returns the value of attribute subsectors.
5 6 7 |
# File 'lib/sector.rb', line 5 def subsectors @subsectors end |
Instance Method Details
#get_subsector_by_id(id) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sector.rb', line 16 def get_subsector_by_id(id) subsectors.each do |subsector| if subsector.id == id return subsector end subsubsector = subsector.get_subsector_by_id(id) if not subsubsector.nil? return subsubsector end end return nil end |