abstract-data-types 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/abstract-data-types.rb +1 -0
- data/lib/abstract-data-types/OctetString.rb +23 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a9c31e0afe9145ac4c965c39c5d6840871f1e13d
|
4
|
+
data.tar.gz: 10b5fd7e3a8f9acd24ad2a3219c69ed89444b8e6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9cad8faec7af4bd962775d4bf2bf28ddf18f1afd910b62335e47237b404b9f3d85164ccd3ece2bec73ef8653573b87124f4bae51b326e327132cd3cca7caee07
|
7
|
+
data.tar.gz: ea64a3c1b756dbb32fabbffb10f72664a685fcbffd95cd28d8fae60f538069840ae0ce2a3a6886c922b5ec5af6c98d44b4ca87e5d481b4b30f9b8daebfd720f6
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'abstract-data-types/OctetString'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module ADT
|
2
|
+
|
3
|
+
class OctetString
|
4
|
+
|
5
|
+
def self.to_array(octetstring)
|
6
|
+
self.to_bitstring(octetstring).split("")
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.to_bitstring(octetstring)
|
10
|
+
octetstring.unpack('B*')[0]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.from_array(array)
|
14
|
+
self.from_bitstring(array.join(""))
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.from_bitstring(bitstring)
|
18
|
+
[bitstring].pack('B*')
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: abstract-data-types
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- caezs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This gem tries to mock some data types by mainly providing conversion
|
14
|
+
between them and the built-in data types.
|
15
|
+
email: contact.steinert@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/abstract-data-types.rb
|
21
|
+
- lib/abstract-data-types/OctetString.rb
|
22
|
+
homepage: http://rubygems.org/gems/abstract-data-types
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.2.2
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Supplying abstract data types for ruby.
|
46
|
+
test_files: []
|