Sha256: 0b39de3b6c0119831ce77616e05e1c9e6e1174ad80d673ee4f9c0b826263835b

Contents?: true

Size: 611 Bytes

Versions: 6

Compression:

Stored size: 611 Bytes

Contents

module Ulla
  class EnvironmentClassHash < Hash

    def group_by_non_residue_labels
      self.values.group_by { |env| env.label[1..-1] }
    end

    def groups_sorted_by_residue_labels
      group_by_non_residue_labels.to_a.sort_by { |env_group|
        env_group[0].gsub('-', '').split('').map_with_index { |l, i|
          if i < ($env_features.size - 1)
            $env_features[i + 1].labels.index(l)
          else
            $env_features[i + 2 - $env_features.size].labels.index(l)
          end
        }
      }
    end

    def group_size
      group_by_non_residue_labels.size
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
semin-ulla-0.9.7 lib/ulla/environment_class_hash.rb
semin-ulla-0.9.8 lib/ulla/environment_class_hash.rb
semin-ulla-0.9.9 lib/ulla/environment_class_hash.rb
ulla-0.9.9 lib/ulla/environment_class_hash.rb
ulla-0.9.8 lib/ulla/environment_class_hash.rb
ulla-0.9.7 lib/ulla/environment_class_hash.rb