class PlatformGuard

Public Class Methods

new(*args) click to toggle source
# File lib/mspec/guards/platform.rb, line 8
def initialize(*args)
  if args.last.is_a?(Hash)
    @options, @platforms = args.last, args[0..-2]
  else
    @options, @platforms = {}, args
  end
  self.parameters = args
end
windows?() click to toggle source
# File lib/mspec/guards/platform.rb, line 4
def self.windows?
  PlatformGuard.new(:os => :windows).match?
end

Public Instance Methods

match?() click to toggle source
# File lib/mspec/guards/platform.rb, line 17
def match?
  match = @platforms.empty? ? true : platform?(*@platforms)
  @options.each do |key, value|
    case key
    when :os
      match &&= os?(*value)
    when :wordsize
      match &&= wordsize? value
    end
  end
  match
end