Skip to content
This repository
Browse code

Adjust yard documentation

  • Loading branch information...
commit 81b3e4b721a6029616b31f5f5bb1b8530f5cccd8 1 parent c9671b4
Lars Kanis authored

Showing 2 changed files with 21 additions and 18 deletions. Show diff stats Hide diff stats

  1. +1 0  .yardopts
  2. +20 18 lib/libusb.rb
1  .yardopts
... ... @@ -0,0 +1 @@
  1 +--title "libusb-1.0 Ruby Interface" --no-private lib/**/*.rb
38 lib/libusb.rb
@@ -235,6 +235,7 @@ def self.release(ptr)
235 235 Call::RequestRecipients.to_h.each{|k,v| const_set(k,v) }
236 236 Call::IsoSyncTypes.to_h.each{|k,v| const_set(k,v) }
237 237
  238 + # Base class of libusb errors
238 239 class Error < RuntimeError
239 240 end
240 241 ErrorClassForResult = {}
@@ -592,6 +593,7 @@ def packet_lengths=(len)
592 593 private :actual_length, :actual_buffer
593 594 end
594 595
  596 + # @private
595 597 class DeviceDescriptor < FFI::Struct
596 598 include Comparable
597 599
@@ -714,15 +716,15 @@ def inspect
714 716 "\#<#{self.class} #{attrs.join(' ')}>"
715 717 end
716 718
717   - # Return name of the configuration as String.
  719 + # Return name of this configuration as String.
718 720 def description
719 721 return @description if defined? @description
720 722 @description = device.try_string_descriptor_ascii(self.iConfiguration)
721 723 end
722 724
723   - # Return all interface decriptions of the configuration as Array of InterfaceDescriptor s.
  725 + # Return all interface decriptions of the configuration as Array of {Setting}s.
724 726 def settings() self.interfaces.map {|d| d.settings }.flatten end
725   - # Return all endpoints of all interfaces of the configuration as Array of EndpointDescriptor s.
  727 + # Return all endpoints of all interfaces of the configuration as Array of {Endpoint}s.
726 728 def endpoints() self.settings.map {|d| d.endpoints }.flatten end
727 729
728 730 def <=>(o)
@@ -755,9 +757,9 @@ def alt_settings
755 757 end
756 758 alias settings alt_settings
757 759
758   - # The Device the Interface belongs to.
  760 + # The {Device} this Interface belongs to.
759 761 def device() self.configuration.device end
760   - # Return all endpoints of all alternative settings as Array of EndpointDescriptor s.
  762 + # Return all endpoints of all alternative settings as Array of {Endpoint}s.
761 763 def endpoints() self.alt_settings.map {|d| d.endpoints }.flatten end
762 764
763 765 def <=>(o)
@@ -811,12 +813,12 @@ def bInterfaceClass
811 813 self[:bInterfaceClass]
812 814 end
813 815
814   - # USB-IF subclass code for this interface, qualified by the bInterfaceClass value.
  816 + # USB-IF subclass code for this interface, qualified by the {bInterfaceClass} value.
815 817 def bInterfaceSubClass
816 818 self[:bInterfaceSubClass]
817 819 end
818 820
819   - # USB-IF protocol code for this interface, qualified by the bInterfaceClass and bInterfaceSubClass values.
  821 + # USB-IF protocol code for this interface, qualified by the {bInterfaceClass} and {bInterfaceSubClass} values.
820 822 def bInterfaceProtocol
821 823 self[:bInterfaceProtocol]
822 824 end
@@ -860,15 +862,15 @@ def inspect
860 862 "\#<#{self.class} #{attrs.join(' ')}>"
861 863 end
862 864
863   - # Return name of the Interface as String.
  865 + # Return name of this interface as String.
864 866 def description
865 867 return @description if defined? @description
866 868 @description = device.try_string_descriptor_ascii(self.iInterface)
867 869 end
868 870
869   - # The Device the InterfaceDescriptor belongs to.
  871 + # The {Device} this Setting belongs to.
870 872 def device() self.interface.configuration.device end
871   - # The ConfigDescriptor the InterfaceDescriptor belongs to.
  873 + # The {Configuration} this Setting belongs to.
872 874 def configuration() self.interface.configuration end
873 875
874 876 def <=>(o)
@@ -914,7 +916,7 @@ def bEndpointAddress
914 916 self[:bEndpointAddress]
915 917 end
916 918
917   - # Attributes which apply to the endpoint when it is configured using the bConfigurationValue.
  919 + # Attributes which apply to the endpoint when it is configured using the {Configuration#bConfigurationValue}.
918 920 #
919 921 # * Bits 0..1: Transfer Type
920 922 # * 00 = Control
@@ -994,11 +996,11 @@ def inspect
994 996 "\#<#{self.class} #{num} #{inout} #{type.join(" ")}>"
995 997 end
996 998
997   - # The Device the EndpointDescriptor belongs to.
  999 + # The {Device} this Endpoint belongs to.
998 1000 def device() self.setting.interface.configuration.device end
999   - # The ConfigDescriptor the EndpointDescriptor belongs to.
  1001 + # The {Configuration} this Endpoint belongs to.
1000 1002 def configuration() self.setting.interface.configuration end
1001   - # The Interface the EndpointDescriptor belongs to.
  1003 + # The {Interface} this Endpoint belongs to.
1002 1004 def interface() self.setting.interface end
1003 1005
1004 1006 def <=>(o)
@@ -1261,7 +1263,7 @@ def bcdUSB
1261 1263
1262 1264 # USB-IF class code for the device (Assigned by USB Org)
1263 1265 #
1264   - # * If equal to 0x00, each interface specifies its own class code
  1266 + # * If equal to 0x00, each interface specifies it's own class code
1265 1267 # * If equal to 0xFF, the class code is vendor specified
1266 1268 # * Otherwise field is valid Class Code
1267 1269 def bDeviceClass
@@ -1389,13 +1391,13 @@ def configurations
1389 1391 configs
1390 1392 end
1391 1393
1392   - # Return all interfaces of the device.
  1394 + # Return all interfaces of this device.
1393 1395 # @return [Array<Interface>]
1394 1396 def interfaces() self.configurations.map {|d| d.interfaces }.flatten end
1395   - # Return all interface decriptions of the device.
  1397 + # Return all interface decriptions of this device.
1396 1398 # @return [Array<Setting>]
1397 1399 def settings() self.interfaces.map {|d| d.settings }.flatten end
1398   - # Return all endpoints of all interfaces of the device.
  1400 + # Return all endpoints of all interfaces of this device.
1399 1401 # @return [Array<Endpoint>]
1400 1402 def endpoints() self.settings.map {|d| d.endpoints }.flatten end
1401 1403

0 comments on commit 81b3e4b

Please sign in to comment.
Something went wrong with that request. Please try again.