Class: Parliament::Utils::Helpers::BusinessItemGroupingHelper
- Inherits:
-
Object
- Object
- Parliament::Utils::Helpers::BusinessItemGroupingHelper
- Extended by:
- GroupingHelper
- Defined in:
- lib/parliament/utils/helpers/business_item_grouping_helper.rb
Defined Under Namespace
Classes: BusinessItemGroupedObject
Class Method Summary collapse
-
.create_grouped_objects(data_hash, key) ⇒ Array
Creates new BusinessItemGroupingHelper::BusinessItemGroupedObject, for each set of Grom::Nodes that have been grouped (nodes) and unknown Each instance of BusinessItemGroupingHelper::BusinessItemGroupedObject is assigned properties of laying_date, nodes and type.
Methods included from GroupingHelper
create_sorted_array, group, group_data
Class Method Details
.create_grouped_objects(data_hash, key) ⇒ Array
Creates new BusinessItemGroupingHelper::BusinessItemGroupedObject, for each set of Grom::Nodes that have been grouped (nodes) and unknown Each instance of BusinessItemGroupingHelper::BusinessItemGroupedObject is assigned properties of laying_date, nodes and type
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/parliament/utils/helpers/business_item_grouping_helper.rb', line 21 def self.create_grouped_objects(data_hash, key) grouped = [] grouped_object = BusinessItemGroupingHelper::BusinessItemGroupedObject.new grouped_object.nodes = data_hash[key].sort_by(&:shortest_distance_of_procedure_steps) # Set properties of the object grouped_object.type = grouped_object.nodes.first.type grouped_object.date = grouped_object.nodes.first.date grouped << grouped_object end |