Class: CPUInfo::CPUS::CPU::CPUFlags

Inherits:
Object
  • Object
show all
Defined in:
lib/cpuinfo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flagstring) ⇒ CPUFlags

Returns a new instance of CPUFlags.



54
55
56
# File 'lib/cpuinfo.rb', line 54

def initialize(flagstring)
    @flags = flagstring.split(' ')
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *params) ⇒ Object



58
59
60
61
62
# File 'lib/cpuinfo.rb', line 58

def method_missing(method, *params)
    if method[-1] == '?'
        return @flags.include? method[0..-2]
    end
end

Instance Attribute Details

#flagsObject (readonly)

Returns the value of attribute flags.



52
53
54
# File 'lib/cpuinfo.rb', line 52

def flags
  @flags
end