Sha256: 1f95a30d44e524e7d80836c0cd404916f7d3065f4e9cdf7f19489f3f1f543d88

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

class Pa
  class Util
    module Concern
      def included(base)
        base.extend const_get(:ClassMethods) if const_defined?(:ClassMethods)
        base.send :include, const_get(:InstanceMethods) if const_defined?(:InstanceMethods)
      end
    end

    class << self
      # extract options
      # @see extract_options!
      # @example
      #   def mkdir(*args)
      #     paths, o = args.extract_options
      #   end
      #
      # @return [Array<Array,Hash>] 
      def extract_options(ary, default={})
        if ary.last.is_a?(Hash) && ary.last.instance_of?(Hash)
          [ary[0...-1], ary[-1].merge(default)]
        else
          [ary, default]
        end
      end

      def wrap_array(value)
        Array === value ? value : [value]
      end

      def win32? 
        RUBY_PLATFORM =~ /mingw32|mswin/ 
      end 
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pa-1.2.1 lib/pa/util.rb