rstructural 0.1.1 → 0.1.2
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +27 -3
- data/bin/console +1 -1
- data/lib/rstructural/struct.rb +1 -1
- data/rstructural.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8f95857064c7ea8117d34867bf68c59162e2e6315b3961fdc7f7ec62aeba03
|
4
|
+
data.tar.gz: 794a7abee762cdf543bc05782185ac81e7664355f74113a47525f8ea6e459216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 627653a650eb6431832554f1dba31535bbeeb7fa9dea2c8d3f71d8e02e838a50a52c199f3e6239ad2da86c5f29e2c8fd39428f003b68ba2b100091ecb30d1bdd
|
7
|
+
data.tar.gz: 78a6133b2a328d78375eaf1eb84f2502049dcf9f2b2408a49cff6647aafd4d1ae1512cba26730c959c565f096be5fd395448b3b0bed91497c126a9f4ad602f50
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
# Ruby
|
1
|
+
# Rstructural - Ruby structural types
|
2
|
+
|
3
|
+
[](https://badge.fury.io/rb/rstructural)
|
4
|
+
[](https://github.com/petitviolet/rstructural/actions)
|
2
5
|
|
3
6
|
- Rstruct
|
4
7
|
- Struct implemented with Ruby
|
@@ -13,7 +16,7 @@
|
|
13
16
|
Add this line to your application's Gemfile:
|
14
17
|
|
15
18
|
```ruby
|
16
|
-
gem '
|
19
|
+
gem 'rstructural'
|
17
20
|
```
|
18
21
|
|
19
22
|
And then execute:
|
@@ -22,10 +25,31 @@ And then execute:
|
|
22
25
|
|
23
26
|
Or install it yourself as:
|
24
27
|
|
25
|
-
$ gem install
|
28
|
+
$ gem install rstructural
|
26
29
|
|
27
30
|
## Usage
|
28
31
|
|
32
|
+
### require
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
require 'rstructural'
|
36
|
+
# Imported these types
|
37
|
+
# - Rstruct
|
38
|
+
# - Enum
|
39
|
+
# - ADT
|
40
|
+
```
|
41
|
+
|
42
|
+
or, require each modules with namespace `Rstructural`
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
require 'rstructural/struct'
|
46
|
+
# - Rstructural::Struct
|
47
|
+
require 'rstructural/enum'
|
48
|
+
# - Rstructural::Enum
|
49
|
+
require 'rstructural/adt'
|
50
|
+
# - Rstructural::ADT
|
51
|
+
```
|
52
|
+
|
29
53
|
### Rstruct
|
30
54
|
|
31
55
|
```ruby
|
data/bin/console
CHANGED
data/lib/rstructural/struct.rb
CHANGED
@@ -30,7 +30,7 @@ module Rstructural
|
|
30
30
|
|
31
31
|
def ==(other)
|
32
32
|
return false if other.class != self.class
|
33
|
-
#{attributes.map { |attr| "other.#{attr} == self.#{attr}" }.join(" && ")}
|
33
|
+
#{attributes.empty? ? true : attributes.map { |attr| "other.#{attr} == self.#{attr}" }.join(" && ")}
|
34
34
|
end
|
35
35
|
|
36
36
|
def inspect
|
data/rstructural.gemspec
CHANGED