Class: Crubyflie::CrubyflieURI
- Inherits:
-
Object
- Object
- Crubyflie::CrubyflieURI
- Defined in:
- lib/crubyflie/driver/radio_driver.rb
Overview
Small URI class since Ruby URI < 1.9.3 gives problems parsing Crazyflie URIs
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#dongle ⇒ Object
readonly
Returns the value of attribute dongle.
-
#rate ⇒ Object
readonly
Returns the value of attribute rate.
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
Instance Method Summary collapse
-
#initialize(uri_str) ⇒ CrubyflieURI
constructor
Initialize an URI.
-
#to_s ⇒ String
Return URI as string.
Constructor Details
#initialize(uri_str) ⇒ CrubyflieURI
Initialize an URI
35 36 37 38 39 40 41 42 |
# File 'lib/crubyflie/driver/radio_driver.rb', line 35 def initialize(uri_str) @uri_str = uri_str @scheme, @dongle, @channel, @rate = split() if @scheme.nil? || @dongle.nil? || @channel.nil? || @rate.nil? || @scheme != 'radio' raise InvalidURIException.new('Bad URI') end end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
32 33 34 |
# File 'lib/crubyflie/driver/radio_driver.rb', line 32 def channel @channel end |
#dongle ⇒ Object (readonly)
Returns the value of attribute dongle.
32 33 34 |
# File 'lib/crubyflie/driver/radio_driver.rb', line 32 def dongle @dongle end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
32 33 34 |
# File 'lib/crubyflie/driver/radio_driver.rb', line 32 def rate @rate end |
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
32 33 34 |
# File 'lib/crubyflie/driver/radio_driver.rb', line 32 def scheme @scheme end |
Instance Method Details
#to_s ⇒ String
Return URI as string
46 47 48 |
# File 'lib/crubyflie/driver/radio_driver.rb', line 46 def to_s @uri_str end |