Class: Vigilem::Evdev::Stat

Inherits:
Core::Stat
  • Object
show all
Defined in:
lib/vigilem/evdev/stat.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_name = 'vigilem-evdev', opts = {}, &api_check) ⇒ Stat

Returns a new instance of Stat.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/vigilem/evdev/stat.rb', line 10

def initialize(gem_name='vigilem-evdev', opts={}, &api_check)
  system_name = 'evdev'
  opts[:path] ||= event_dir
  if block_given?
    super(system_name, gem_name, opts, &api_check)
  else
    super(system_name, gem_name, opts) do
      Dir.exists?(opts[:path]) and Dir["#{opts[:path]}#{File::SEPARATOR}event*"].any?
    end
  end
end

Instance Attribute Details

#event_dirString

Returns:

  • (String)


24
25
26
# File 'lib/vigilem/evdev/stat.rb', line 24

def event_dir
  @event_path ||= "#{File::SEPARATOR}#{File.join(%w(dev input))}"
end

Class Method Details

.defaultObject



30
31
32
# File 'lib/vigilem/evdev/stat.rb', line 30

def self.default
  @default ||= Vigilem::Evdev::Stat.new
end