module Softwear

Constants

COMMON_GEMS
GEMFILE_CLOSER
GEMFILE_OPENER
VERSION

Public Class Methods

fix_sort_argument_error_on_rubinius() click to toggle source
# File lib/softwear.rb, line 78
def self.fix_sort_argument_error_on_rubinius
  # Rubinius calls Enumerator#sort! within Enumerator#sort_by,
  # # and Mail::PartsList calls sort_by within sort!... See the
  # problem?

  if RUBY_ENGINE == 'rbx'
    require 'mail'

    Mail::PartsList.class_eval do
      def map!(&block)
        Mail::PartsList.new(collect(&block))
      end

      def sort!(order = nil)
        return super() if order.nil?

        i = 0
        sorted = self.sort_by do |a|
          [get_order_value(a, order), i += 1]
        end
        self.clear
        sorted.each(&self.method(:<<))
      end
    end
  end
end
fix_state_machine_around_validation() click to toggle source
# File lib/softwear.rb, line 105
def self.fix_state_machine_around_validation
  StateMachine::Integrations::ActiveModel.instance_eval { public :around_validation }
end

Public Instance Methods

map!(&block) click to toggle source
# File lib/softwear.rb, line 87
def map!(&block)
  Mail::PartsList.new(collect(&block))
end
sort!(order = nil) click to toggle source
Calls superclass method
# File lib/softwear.rb, line 91
def sort!(order = nil)
  return super() if order.nil?

  i = 0
  sorted = self.sort_by do |a|
    [get_order_value(a, order), i += 1]
  end
  self.clear
  sorted.each(&self.method(:<<))
end