Module: Vigilem::Core::System

Defined in:
lib/vigilem/core/system/check.rb

Class Method Summary collapse

Class Method Details

.checkTruceClass || FalseClass

common checks for os and input_system pass ‘check[/win/]` and it will #=~ against `RbConfig::CONFIG` pass a string and it uses #== for input_sysmte_handlers it #find’s the input_system_handler with the name that #=~ the argument or #== it

Returns:

  • (TruceClass || FalseClass)

    whether or not the check passed



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vigilem/core/system/check.rb', line 15

def self.check
  @checks ||= {
      :os => lambda do |str_or_regex, os=nil|
              os ||= Support::System.os
              !!(str_or_regex.is_a?(Regexp) and 
                str_or_regex =~ os) or 
                (str_or_regex.to_s == os.to_s)
            end,
      :input_system => lambda do |name_or_regex|
              ((name_or_regex.is_a?(Regexp) and 
                (stats = Stat.all_available).find {|isys| isys.input_system_name =~ name_or_regex }) or
                (stats.find {|isys| isys.input_system_name.to_s == name_or_regex.to_s })
              )
            end
    }
end