Sha256: ed239bc32b726be18e0498333c64de0aca11825adc4f1b39497362cdc7198c62

Contents?: true

Size: 429 Bytes

Versions: 4

Compression:

Stored size: 429 Bytes

Contents

module Mac
  module EventMonitor
    class MouseEvent < Event
      attr_reader :location, :button

      def initialize(type, location_as_str, button)
        super(type)

        @location = parse_location(location_as_str)
        @button = button
      end

      private

      def parse_location(location_as_str)
        Struct.new(:x, :y).new(*location_as_str.scan(/[\d\.]+/).map {|v| v.to_f })
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mac-event-monitor-0.1.0 lib/mac-event-monitor/event/mouse_event.rb
mac-event-monitor-0.0.3 lib/mac-event-monitor/event/mouse_event.rb
mac-event-monitor-0.0.2 lib/mac-event-monitor/event/mouse_event.rb
mac-event-monitor-0.0.1 lib/mac-event-monitor/event/mouse_event.rb