ure 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +43 -6
- data/README.md +1 -1
- data/lib/ure.rb +27 -0
- data/lib/ure/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f3cf82f8e01a109b41d7a8ff69063061ed0ccec
|
4
|
+
data.tar.gz: 373bf2711371e35ea41d317dac7601670e047f82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f4c9ab56fa34c705fbe6a853539102955a105d1724e9dc9efbd46ffe4cdb91b4c9ea018006b14f26e2eb98116001e03e64378e3d3d89d80716e9577be623e62
|
7
|
+
data.tar.gz: 4f1eeb24299b2249f093cdde3dbe44202f5fa35bfb79716d3f67d7b1f6ab334eade4086d7b0c82ce30a498f9bb215696738878b29734df17dd7b78801e062f0c
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,13 +1,50 @@
|
|
1
1
|
# Contributor Code of Conduct
|
2
2
|
|
3
|
-
As contributors and maintainers of this project,
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
4
7
|
|
5
|
-
We are committed to making participation in this project a harassment-free
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
6
12
|
|
7
|
-
Examples of unacceptable behavior by participants include
|
13
|
+
Examples of unacceptable behavior by participants include:
|
8
14
|
|
9
|
-
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
10
22
|
|
11
|
-
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
12
28
|
|
13
|
-
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at claytonflesher@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
|
45
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
46
|
+
version 1.3.0, available at
|
47
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
48
|
+
|
49
|
+
[homepage]: http://contributor-covenant.org
|
50
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/README.md
CHANGED
@@ -108,7 +108,7 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
108
108
|
|
109
109
|
## Contributing
|
110
110
|
|
111
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/Calvyn82/ure. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](
|
111
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Calvyn82/ure. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](CODE_OF_CONDUCT.md) code of conduct.
|
112
112
|
|
113
113
|
|
114
114
|
## License
|
data/lib/ure.rb
CHANGED
@@ -1,11 +1,18 @@
|
|
1
1
|
require "ure/version"
|
2
2
|
require "json"
|
3
|
+
##
|
4
|
+
# Immutable alternative to Struct that requires keyword arguments
|
3
5
|
class Ure < BasicObject
|
4
6
|
include ::Enumerable
|
7
|
+
|
8
|
+
##
|
9
|
+
# Returns the ure members as an array of symbols.
|
5
10
|
def self.members
|
6
11
|
@members.freeze
|
7
12
|
end
|
8
13
|
|
14
|
+
##
|
15
|
+
# Create an ure named by its constant.
|
9
16
|
def self.new(*members, &body)
|
10
17
|
::Class.new(self) do
|
11
18
|
instance_variable_set(:@members, members)
|
@@ -58,6 +65,8 @@ class Ure < BasicObject
|
|
58
65
|
|
59
66
|
attr_reader :fields
|
60
67
|
|
68
|
+
##
|
69
|
+
# Equality---Returns true if other has the same ure subclass and has equal member values.
|
61
70
|
def ==(arg)
|
62
71
|
if self.class == arg.class
|
63
72
|
fields == arg.fields
|
@@ -68,38 +77,56 @@ class Ure < BasicObject
|
|
68
77
|
false
|
69
78
|
end
|
70
79
|
|
80
|
+
##
|
81
|
+
# Because Ure doesn't care about indexing, this allows users to treat instances of Ure as a hash.
|
71
82
|
def [](key)
|
72
83
|
fields[key]
|
73
84
|
end
|
74
85
|
|
86
|
+
##
|
87
|
+
# Converts the fields into a hash and calls each on them.
|
75
88
|
def each(&block)
|
76
89
|
to_h.each(&block)
|
77
90
|
end
|
78
91
|
|
92
|
+
##
|
93
|
+
# Returns a string describing the object and its fields
|
79
94
|
def to_s
|
80
95
|
"#<#{::Ure} #{self.class} #{fields.to_s}"
|
81
96
|
end
|
82
97
|
|
98
|
+
##
|
99
|
+
# Returns a string describing the object and its fields
|
83
100
|
def inspect
|
84
101
|
"#<#{::Ure} #{self.class} #{fields.to_s}"
|
85
102
|
end
|
86
103
|
|
104
|
+
##
|
105
|
+
# Alias for #values
|
87
106
|
def to_a
|
88
107
|
fields.values
|
89
108
|
end
|
90
109
|
|
110
|
+
##
|
111
|
+
# Alias for #fields
|
91
112
|
def to_h
|
92
113
|
fields.to_h
|
93
114
|
end
|
94
115
|
|
116
|
+
##
|
117
|
+
# Returns an array of the values in the fields
|
95
118
|
def values
|
96
119
|
fields.values
|
97
120
|
end
|
98
121
|
|
122
|
+
##
|
123
|
+
# Takes one or more keys as arguments, and returns an array of the corresponding values.
|
99
124
|
def values_at(name, *args)
|
100
125
|
[fields[name]] + args.map { |arg| fields[arg] }
|
101
126
|
end
|
102
127
|
|
128
|
+
##
|
129
|
+
# Returns a JSON string of members and values.
|
103
130
|
def to_json
|
104
131
|
fields.to_json
|
105
132
|
end
|
data/lib/ure/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clayton Flesher
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|