lib/ury_rapid/services/code_table.rb
def code_symbol(code)
        # Assume that the only constants defined in Codes are code groups...
        submodules = constants.map(&method(:const_get))
        # ...and the only constants defined in code groups are codes, and they
        # are disjoint.
        found = nil
        submodules.each { |s| found = find_code_in(s, code) unless found }
        fail("Unknown code number: #{code.to_s(16)}") unless found
        found
      end
# Given a code, return a vaguely descriptive textual description
#
# This is mainly intended for debugging and logging purposes, and is
# wholly inadequate for user-facing code.  You have been warned!
#
# @api semipublic
#
# @example Find the name of a command code.
#   # Assuming Rapid::Baps::Codes includes CodeTable,
#   Rapid::Baps::Codes.code_symbol(Rapid::Baps::Codes::Playback::PLAY)
#   #=> "Rapid::Baps::Codes::Playback::PLAY"
#
# @param code [Integer] A code in the code table.
#
# @return [String] The (semi) human-readable name for the code.
Given a code, return a vaguely descriptive textual description
This is mainly intended for debugging and logging purposes, and is
wholly inadequate for user-facing code.  You have been warned!
Given a code return a vaguely descriptive textual description This is mainly intended for debugging and logging purposes and is wholly inadequate for user - facing code . You have been warned!
def code_symbol(code)
        submodules = constants.map(&method(:const_get))
        found = nil
        submodules.each { |s| found = find_code_in(s, code) unless found }
        fail("Unknown code number: #{code.to_s(16)}") unless found
        found
      end
def code_symbol ( code ) submodules = constants . map ( & method ( :const_get ) ) found = nil submodules . each { | s | found = find_code_in ( s , code ) unless found } fail ( "Unknown code number: #{code.to_s(16)}" ) unless found found end
Given a code, return a vaguely descriptive textual description
This is mainly intended for debugging and logging purposes, and is
wholly inadequate for user-facing code.
Given a code return a vaguely descriptive textual description This is mainly intended for debugging and logging purposes and is wholly inadequate for user - facing code .
# Assume that the only constants defined in Codes are code groups... # ...and the only constants defined in code groups are codes, and they # are disjoint.
The (semi) human-readable name for the code.
The ( semi ) human - readable name for the code .
String
code
A code in the code table.
A code in the code table .
api
None
example
Find the name of a command code. # Assuming Rapid::Baps::Codes includes CodeTable, Rapid::Baps::Codes.code_symbol(Rapid::Baps::Codes::Playback::PLAY) #=> "Rapid::Baps::Codes::Playback::PLAY"
Find the name of a command code . # Assuming Rapid :: Baps :: Codes includes CodeTable Rapid :: Baps :: Codes . code_symbol ( Rapid :: Baps :: Codes :: Playback :: PLAY ) # = > " Rapid :: Baps :: Codes :: Playback :: PLAY "