Sha256: ea7435a416e5609f59620fd25f21176f656f8997d42e71f3b7c1b2fe8557b193

Contents?: true

Size: 454 Bytes

Versions: 5

Compression:

Stored size: 454 Bytes

Contents

module Egor
  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].split('').map_with_index { |l, i|
          $env_features[i + 1].labels.index(l)
        }
      }
    end

    def group_size
      group_by_non_residue_labels.size
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
semin-egor-0.9.0 lib/egor/environment_class_hash.rb
semin-egor-0.9.1 lib/egor/environment_class_hash.rb
semin-egor-0.9.2 lib/egor/environment_class_hash.rb
semin-egor-0.9.3 lib/egor/environment_class_hash.rb
egor-0.9.0 lib/egor/environment_class_hash.rb