lib/bindata/sanitize.rb
# Returns the class matching a previously registered +name+.
Returns the class matching a previously registered +name+.
Returns the class matching a previously registered + name + .
def lookup(name, endian)
        name = name.to_s
        klass = Registry.instance.lookup(name)
        if klass.nil? and endian != nil
          if /^u?int\d{1,3}$/ =~ name
            new_name = name + ((endian == :little) ? "le" : "be")
            klass = Registry.instance.lookup(new_name)
          elsif ["float", "double"].include?(name)
            new_name = name + ((endian == :little) ? "_le" : "_be")
            klass = Registry.instance.lookup(new_name)
          end
        end
        klass
      end
def lookup ( name , endian ) name = name . to_s klass = Registry . instance . lookup ( name ) if klass . nil? and endian != nil if / ^u?int \d {1,3}$ / =~ name new_name = name + ( ( endian == :little ) ? "le" : "be" ) klass = Registry . instance . lookup ( new_name ) elsif [ "float" , "double" ] . include? ( name ) new_name = name + ( ( endian == :little ) ? "_le" : "_be" ) klass = Registry . instance . lookup ( new_name ) end end klass end
Returns the class matching a previously registered +name+.
Returns the class matching a previously registered + name + .
# lookup failed so attempt endian lookup
name
<not_specific>
endian
<not_specific>