Class: Teems::Commands::OrgRenderer::OrgData
- Inherits:
-
Struct
- Object
- Struct
- Teems::Commands::OrgRenderer::OrgData
- Defined in:
- lib/teems/commands/org.rb
Overview
Groups org chart data: managers chain, target user, and reports tree
Instance Attribute Summary collapse
-
#managers ⇒ Object
Returns the value of attribute managers.
-
#reports ⇒ Object
Returns the value of attribute reports.
-
#target ⇒ Object
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#managers ⇒ Object
Returns the value of attribute managers
78 79 80 |
# File 'lib/teems/commands/org.rb', line 78 def managers @managers end |
#reports ⇒ Object
Returns the value of attribute reports
78 79 80 |
# File 'lib/teems/commands/org.rb', line 78 def reports @reports end |
#target ⇒ Object
Returns the value of attribute target
78 79 80 |
# File 'lib/teems/commands/org.rb', line 78 def target @target end |
Class Method Details
.json_report(user, sub_reports) ⇒ Object
88 89 90 |
# File 'lib/teems/commands/org.rb', line 88 def self.json_report(user, sub_reports) user.to_h.merge(direct_reports: json_reports(sub_reports)) end |
.json_reports(reports) ⇒ Object
84 85 86 |
# File 'lib/teems/commands/org.rb', line 84 def self.json_reports(reports) reports.map { |report| json_report(*report.values_at(:user, :reports)) } end |
Instance Method Details
#to_json_hash ⇒ Object
79 80 81 82 |
# File 'lib/teems/commands/org.rb', line 79 def to_json_hash { managers: managers.map(&:to_h), target: target.to_h, direct_reports: self.class.json_reports(reports[:reports]) } end |