Class: Artoo::Drivers::Leapmotion::Pointable

Inherits:
Object
  • Object
show all
Defined in:
lib/artoo/drivers/leapmotion/pointable.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Pointable

Returns a new instance of Pointable.



16
17
18
19
20
21
# File 'lib/artoo/drivers/leapmotion/pointable.rb', line 16

def initialize(data)
  data.each do |k, v|
    instance_variable_set("@#{k}", v)
    self.class.send(:define_method, k.to_sym, lambda { instance_variable_get("@#{k}") })
  end
end

Class Method Details

.list(data) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/artoo/drivers/leapmotion/pointable.rb', line 6

def self.list(data)
  pointables = []
  if data["pointables"]
    data["pointables"].each do |pointable|
      pointables << Artoo::Drivers::Leapmotion::Pointable.new(pointable)
    end
  end
  return pointables
end