Class: LEAP::Motion::WS::Hand

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Hand

Returns a new instance of Hand.



15
16
17
18
19
20
# File 'lib/leap/motion/ws/hand.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/hand.rb', line 5

def self.list(data)
  hands = []
  if data["hands"]
    data["hands"].each do |hand|
      hands << LEAP::Motion::WS::Hand.new(hand)
    end
  end
  return hands
end