Class: Revdev::InputId

Inherits:
Object
  • Object
show all
Includes:
EachValuesEqual
Defined in:
lib/revdev/input_id.rb,
lib/revdev.rb

Overview

wraper of "struct input_id" on "input.h"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EachValuesEqual

#==

Constructor Details

#initialize(arg = nil, vendor = nil, product = nil, version = nil) ⇒ InputId

Returns a new instance of InputId.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/revdev/input_id.rb', line 10

def initialize(arg=nil, vendor=nil, product=nil, version=nil)
  if arg.kind_of? String
    raw_initialize arg
  elsif arg.kind_of? Hash
    [:bustype, :vendor, :product, :version].each do |iv|
      instance_variable_set("@#{iv}", arg[iv] || arg[iv.to_s])
    end
  else
    @bustype = arg
    @vendor = vendor
    @product = product
    @version = version
  end
end

Instance Attribute Details

#bustypeObject

Returns the value of attribute bustype.



8
9
10
# File 'lib/revdev/input_id.rb', line 8

def bustype
  @bustype
end

#productObject

Returns the value of attribute product.



8
9
10
# File 'lib/revdev/input_id.rb', line 8

def product
  @product
end

#vendorObject

Returns the value of attribute vendor.



8
9
10
# File 'lib/revdev/input_id.rb', line 8

def vendor
  @vendor
end

#versionObject

Returns the value of attribute version.



8
9
10
# File 'lib/revdev/input_id.rb', line 8

def version
  @version
end