diff options
| author | realtradam <[email protected]> | 2022-01-03 08:19:24 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-01-03 08:19:24 -0500 |
| commit | aad51d646812804052ce2ae5e926b667b4e24d6d (patch) | |
| tree | e083c5fe4b8a388c87eab8ce955b966ebab22238 /lib/felflame/order.rb | |
| parent | 55f1db30e7a609cebd2fab27c55ece1da45be232 (diff) | |
| download | FelECS-aad51d646812804052ce2ae5e926b667b4e24d6d.tar.gz FelECS-aad51d646812804052ce2ae5e926b667b4e24d6d.zip | |
.
Diffstat (limited to 'lib/felflame/order.rb')
| -rw-r--r-- | lib/felflame/order.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/felflame/order.rb b/lib/felflame/order.rb index 0bed66b..3202b25 100644 --- a/lib/felflame/order.rb +++ b/lib/felflame/order.rb @@ -1,6 +1,23 @@ module FelFlame module Order - def sort(*sortables) + + # Sets the priority of all items passed into this method + # according to the order they were passed. + # If an array is one of the elements then it will give all + # of those elements in the array the same priority. + # @param sortables [(Systems and Array<Systems>) or (Scenes and Array<Scenes>)] + # @return [Boolean] +true+. + def self.sort(*sortables) + sortables.each_with_index do |sorted, index| + if sorted.respond_to? :priority + sorted.priority = index + else + sorted.each do |item| + item.priority = index + end + end + end + true end end end |
