Class: GetOrgData

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id


2
3
4
# File 'lib/get_org_data.rb', line 2

def id
  @id
end

#imageObject

Returns the value of attribute image


2
3
4
# File 'lib/get_org_data.rb', line 2

def image
  @image
end

#nameObject

Returns the value of attribute name


2
3
4
# File 'lib/get_org_data.rb', line 2

def name
  @name
end

#parent_idObject

Returns the value of attribute parent_id


2
3
4
# File 'lib/get_org_data.rb', line 2

def parent_id
  @parent_id
end

#titleObject

Returns the value of attribute title


2
3
4
# File 'lib/get_org_data.rb', line 2

def title
  @title
end

Class Method Details

.to_endObject


17
18
19
20
21
# File 'lib/get_org_data.rb', line 17

def self.to_end
  table_end = ""
  table_end << "</table>"
  table_end.html_safe
end

.to_startObject


4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/get_org_data.rb', line 4

def self.to_start
  table_start = ""
  table_start << "<table id='orgChartData' style='display: none;'>"
  table_start<< "<tr>"
  table_start<< "<th>id</th>"
  table_start<<"<th>parent id</th>"
  table_start<<"<th>name</th>"
  table_start<<"<th>title</th>"
  table_start<<"<th>image</th>"
  table_start<<"</tr>"
  table_start.html_safe
end

Instance Method Details

#to_nodeObject


23
24
25
26
27
28
29
30
31
32
33
# File 'lib/get_org_data.rb', line 23

def to_node
  node = ""
  node << "<tr>"
  node << "<td>#{id}</td>"
  node << "<td>#{parent_id}</td>"
  node << "<td>#{name}</td>"
  node << "<td>#{title}</td>"
  node << "<td>#{image}</td>"
  node << "</tr>"
  node.html_safe
end