class Crubyflie::CrubyflieURI

Small URI class since Ruby URI < 1.9.3 gives problems parsing Crazyflie URIs

Attributes

address[R]
channel[R]
dongle[R]
rate[R]
scheme[R]

Public Class Methods

new(uri_str) click to toggle source

Initialize an URI @param uri_str [String] the URI

# File lib/crubyflie/driver/radio_driver.rb, line 34
def initialize(uri_str)
    @uri_str = uri_str
    @scheme, @dongle, @channel, @rate, @address = split()
    if @scheme.nil? || @dongle.nil? || @channel.nil? || @rate.nil? ||
            @scheme != 'radio'
        raise InvalidURIException.new('Bad URI')
    end
end

Public Instance Methods

to_s() click to toggle source

Return URI as string @return [String] a string representation of the URI

# File lib/crubyflie/driver/radio_driver.rb, line 45
def to_s
    @uri_str
end

Private Instance Methods

split() click to toggle source

Quick, dirty uri split

# File lib/crubyflie/driver/radio_driver.rb, line 50
def split
    @uri_str.sub(':', '').sub('//','/').split('/')
end