dword-hex-converter 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/dwordhexconverter.rb +14 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2e73373b3caf46260c2a727bc948f9c289562db8
|
4
|
+
data.tar.gz: 829947e4a0358cae7f1d2d05ca446f3869f1c448
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5102ca42d84e7eb8125c0ae1d7bc998c906acf24b794a71c3e28e8950be40aad64409498f24c80f7709f9c75fc490c8d256c606da2cfe0fb5b5496640da25148
|
7
|
+
data.tar.gz: 9fc4ee4c45fad01de572a6351b80e3548f11b51d22f8ee66e1ad80ddaaa22e48478a80aee0fce7cbedb3069cb0c2dc9a842711b12e6cb56cc03cb0cde6433bfe
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class DwordHexConverter
|
2
|
+
def self.hex2dword(hex)
|
3
|
+
hex = hex.gsub(/^#/, "")
|
4
|
+
return nil if hex.length != 3 && hex.length != 6
|
5
|
+
hex = hex[0] * 2 + hex[1] * 2 + hex[2] * 2 if hex.length == 3
|
6
|
+
return "00" + hex[4..5] + hex[2..3] + hex[0..1]
|
7
|
+
end
|
8
|
+
def self.dword2hex(dword)
|
9
|
+
dword = dword[2..7]
|
10
|
+
return nil if dword.length != 6
|
11
|
+
return "#" + dword[4] + dword[2] + dword[0] if dword[4] == dword[5] && dword[2] == dword[3] && dword[0] == dword[1]
|
12
|
+
return "#" + dword[4..5] + dword[2..3] + dword[0..1]
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dword-hex-converter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Charles Hollenbeck
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Converts Dword values to Hexidecimal values and Hexidecimal values to
|
14
|
+
Dword values
|
15
|
+
email: charles@hollenbeck.pw
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/dwordhexconverter.rb
|
21
|
+
homepage: http://github.com/charles-hollenbeck/dword-hex-converter-gem
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.0.14
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Converts Dwords and Hexidecimal values
|
45
|
+
test_files: []
|