Sha256: a8288ac0939bbf3494f03410179c83169c1c4fe17053913086fb9c01535c3027
Contents?: true
Size: 787 Bytes
Versions: 3
Compression:
Stored size: 787 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 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pa-1.2.0 | lib/pa/util.rb |
pa-1.1.4 | lib/pa/util.rb |
pa-1.1.3 | lib/pa/util.rb |