lib/differential/calculator/group.rb in differential-1.0.4 vs lib/differential/calculator/group.rb in differential-1.0.5
- old
+ new
@@ -20,10 +20,14 @@
attr_reader :id
def initialize(id)
raise ArgumentError, 'id is required' unless id
- @id = id
+ @id = id.is_a?(::Differential::Parser::Id) ? id : ::Differential::Parser::Id.new(id)
+ end
+
+ def sorted_items
+ items.sort_by { |item| item.id.value }
end
def items
items_by_id.values
end