Sha256: 34de1bef7d9a3f452aca8e34a388ef05e84ec6c9b05255de184edb1961395010
Contents?: true
Size: 842 Bytes
Versions: 55
Compression:
Stored size: 842 Bytes
Contents
require 'mspec/utils/version' require 'mspec/guards/guard' class Object # Accepts either a single argument or an Array of arguments. If RUBY_VERSION # is less than 1.9, converts the argument(s) to Strings; otherwise, converts # the argument(s) to Symbols. # # If one argument is passed, the converted argument is returned. If an Array # is passed, an Array is returned. # # For example, if RUBY_VERSION == 1.8.7 # # stasy(:some) => "some" # stasy("nom") => "nom" # # while if RUBY_VERSION == 1.9.0 # # stasy(:some) => :some # stasy("nom") => :nom def stasy(one, *rest) era = SpecVersion.new(SpecGuard.ruby_version) < "1.9" convert = era ? :to_s : :to_sym one = one.send convert if rest.empty? one else [one].concat rest.map { |x| x.send convert } end end end
Version data entries
55 entries across 55 versions & 3 rubygems