Sha256: 7af18081aca00bc43993b0f215dd0e1950e1a38b6b5f913004a69f74f01bc7d6
Contents?: true
Size: 684 Bytes
Versions: 4
Compression:
Stored size: 684 Bytes
Contents
require 'rexml/document' require 'rexml/xpath' require 'cursor_vector' module CanControlsGateway class RawEvent attr_reader :vector, :event_type def initialize xml_node @xml_node = REXML::Document.new(xml_node.to_s) @vector = nil @event_type = nil parse_xml end private def parse_xml @event_type = REXML::XPath.first(@xml_node, "/event/attribute::type") @event_type = @event_type.value if @event_type my_vector_match = REXML::XPath.first(@xml_node, "/event/position") if my_vector_match @vector = CanControlsGateway::CursorVector.new(my_vector_match) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems