Class: Artoo::Drivers::Leapmotion::Hand
- Inherits:
-
Object
- Object
- Artoo::Drivers::Leapmotion::Hand
- Defined in:
- lib/artoo/drivers/leapmotion/hand.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Hand
constructor
A new instance of Hand.
- #palm_x ⇒ Object
- #palm_y ⇒ Object
- #palm_z ⇒ Object
Constructor Details
#initialize(data) ⇒ Hand
Returns a new instance of Hand.
16 17 18 19 20 21 |
# File 'lib/artoo/drivers/leapmotion/hand.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/hand.rb', line 6 def self.list(data) hands = [] if data["hands"] data["hands"].each do |hand| hands << Artoo::Drivers::Leapmotion::Hand.new(hand) end end return hands end |
Instance Method Details
#palm_x ⇒ Object
23 24 25 |
# File 'lib/artoo/drivers/leapmotion/hand.rb', line 23 def palm_x palmPosition[0] if palmPosition end |
#palm_y ⇒ Object
27 28 29 |
# File 'lib/artoo/drivers/leapmotion/hand.rb', line 27 def palm_y palmPosition[2] if palmPosition end |
#palm_z ⇒ Object
31 32 33 |
# File 'lib/artoo/drivers/leapmotion/hand.rb', line 31 def palm_z palmPosition[1] if palmPosition end |