Sha256: 1e1b4ffa18463f5148f06665ed7a481150050163d57f8761e72e77892aa902c3
Contents?: true
Size: 542 Bytes
Versions: 3
Compression:
Stored size: 542 Bytes
Contents
class String def snake_case gsub(/([a-z])([A-Z0-9])/, '\1_\2' ).downcase end def to_w (self+"\x00").encode('utf-16LE') end def to_vkeys unless size == 1 raise "Can't convert but a single character: #{self}" end ascii = upcase.unpack('C')[0] case self when 'a'..'z', '0'..'9', ' ' [ascii] when 'A'..'Z' [0x10, ascii] # Win.const_get(:VK_SHIFT) = 0x10 Bad coupling else raise "Can't convert unknown character: #{self}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
win-0.1.9 | lib/win/extensions.rb |
win-0.1.2 | lib/win/extensions.rb |
win-0.1.0 | lib/win/extensions.rb |