Module: Mry::Rewriters

Defined in:
lib/mry/rewriters.rb

Defined Under Namespace

Classes: Rewriter_0, Rewriter_0_41_0, Rewriter_0_42_0, Rewriter_0_43_0, Rewriter_0_44_0, Rewriter_0_45_0, Rewriter_0_46_0, Rewriter_0_47_0, Rewriter_0_48_0, Rewriter_0_49_0, Rewriter_0_50_0, Rewriter_0_51_0, Rewriter_0_52_0, Rewriter_0_53_0, Rewriter_0_54_0, Rewriter_0_55_0, Rewriter_0_56_0, Rewriter_0_57_0, Rewriter_0_58_0, Rewriter_0_59_0, Rewriter_0_60_0, Rewriter_0_61_0, Rewriter_0_62_0, Rewriter_0_63_0, Rewriter_0_64_0, Rewriter_0_65_0, Rewriter_0_66_0, Rewriter_0_67_0, Rewriter_0_68_0, Rewriter_0_69_0, Rewriter_0_70_0, Rewriter_0_71_0, Rewriter_0_72_0, Rewriter_0_73_0, Rewriter_0_74_0, Rewriter_0_75_0, Rewriter_0_76_0, Rewriter_0_77_0, Rewriter_0_78_0, Rewriter_Master

Constant Summary collapse

Rewriters =
self.constants.grep(/^Rewriter_\d/).map do |name|
  version = Gem::Version.new(name[/Rewriter_(.+)$/, 1].gsub('_', '.'))
  klass = const_get(name)
  [version, klass]
end.sort.reverse.to_h

Class Method Summary collapse

Class Method Details

.rewriters(target) ⇒ Object



289
290
291
292
293
294
295
# File 'lib/mry/rewriters.rb', line 289

def self.rewriters(target)
    return [(Rewriters.values + [Rewriter_Master]).reverse, []] if target == :master

    Rewriters
      .partition{|key, _value| target >= key}
      .map{|rewriters| rewriters.map{|k, v| v}.reverse}
end