class Desmoservice::Families

Attributes

orphan_terms[R]

Public Class Methods

new() click to toggle source
# File lib/families.rb, line 7
def initialize()
  @array = Array.new
  @orphan_members = Array.new
end

Public Instance Methods

[](index) click to toggle source
# File lib/families.rb, line 35
def [](index)
  return @array[index]
end
each() { |v| ... } click to toggle source
# File lib/families.rb, line 25
def each
  @array.each do |v|
    yield(v)
  end
end
length() click to toggle source
# File lib/families.rb, line 31
def length
  return @array.length
end
parse_json(json_string) click to toggle source
# File lib/families.rb, line 12
def parse_json(json_string)
  data = JSON.parse(json_string)
  if data.has_key?('familles')
    familles = data['familles']
    if familles.has_key?('familleArray')
      familles['familleArray'].each {|v| @array << Family.new(v)}
    end
    if familles.has_key?('sansfamille')
      familles['descripteurArray'].each {|v| @orphan_terms << Term.new(v)}
    end
  end
end