Class: LEAP::Motion::WS::Pointable

Inherits:
Object
  • Object
show all
Defined in:
lib/leap/motion/ws/pointable.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Pointable

Returns a new instance of Pointable.



15
16
17
18
19
20
# File 'lib/leap/motion/ws/pointable.rb', line 15

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



5
6
7
8
9
10
11
12
13
# File 'lib/leap/motion/ws/pointable.rb', line 5

def self.list(data)
  pointables = []
  if data["pointables"]
    data["pointables"].each do |pointable|
      pointables << LEAP::Motion::WS::Pointable.new(pointable)
    end
  end
  return pointables
end