astruct 2.11.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/astruct.rb +6 -81
- data/lib/astruct/behavior.rb +251 -0
- data/lib/astruct/version.rb +1 -2
- data/spec/lib/astruct/behavior_spec.rb +10 -0
- data/spec/lib/astruct/version_spec.rb +7 -0
- data/spec/lib/astruct_spec.rb +13 -0
- data/spec/spec_helper.rb +30 -0
- data/test/lib/{astruct_test.rb → astruct/test_behavior.rb} +13 -13
- data/test/test_helper.rb +2 -0
- metadata +91 -78
- data/.gitignore +0 -34
- data/.rvmrc +0 -49
- data/.travis.yml +0 -1
- data/Gemfile +0 -4
- data/Guardfile +0 -14
- data/LICENSE +0 -22
- data/README.md +0 -32
- data/Rakefile +0 -43
- data/astruct.gemspec +0 -23
- data/bench/add_more_vs_ostruct.rb +0 -34
- data/bench/delete_vs_ostruct.rb +0 -33
- data/bench/dump_vs_ostruct.rb +0 -33
- data/bench/dynamic_vs_ostruct.rb +0 -37
- data/bench/inspect_vs_ostruct.rb +0 -33
- data/bench/load_vs_ostruct.rb +0 -33
- data/bench/nested_vs_ostruct.rb +0 -37
- data/bench/new_vs_ostruct.rb +0 -31
- data/bench/some_updates_vs_ostruct.rb +0 -34
- data/lib/astruct/module.rb +0 -162
- data/test/helper.rb +0 -3
- data/test/lib/ostruct_test.rb +0 -227
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,159 +1,172 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: astruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kurtis Rainbolt-Greene
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
14
41
|
- !ruby/object:Gem::Dependency
|
15
42
|
name: rake
|
16
43
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
44
|
requirements:
|
19
|
-
- -
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
20
60
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
61
|
+
version: '0.9'
|
22
62
|
type: :development
|
23
63
|
prerelease: false
|
24
64
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
65
|
requirements:
|
27
|
-
- -
|
66
|
+
- - "~>"
|
28
67
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
68
|
+
version: '0.9'
|
30
69
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
70
|
+
name: pry-doc
|
32
71
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
72
|
requirements:
|
35
|
-
- -
|
73
|
+
- - "~>"
|
36
74
|
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
75
|
+
version: '0.6'
|
38
76
|
type: :development
|
39
77
|
prerelease: false
|
40
78
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
79
|
requirements:
|
43
|
-
- -
|
80
|
+
- - "~>"
|
44
81
|
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
82
|
+
version: '0.6'
|
46
83
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
84
|
+
name: codeclimate-test-reporter
|
48
85
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
86
|
requirements:
|
51
|
-
- -
|
87
|
+
- - "~>"
|
52
88
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
89
|
+
version: '0.4'
|
54
90
|
type: :development
|
55
91
|
prerelease: false
|
56
92
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
93
|
requirements:
|
59
|
-
- -
|
94
|
+
- - "~>"
|
60
95
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
96
|
+
version: '0.4'
|
62
97
|
- !ruby/object:Gem::Dependency
|
63
98
|
name: benchmark-ips
|
64
99
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
100
|
requirements:
|
67
|
-
- -
|
101
|
+
- - "~>"
|
68
102
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
103
|
+
version: '2.0'
|
70
104
|
type: :development
|
71
105
|
prerelease: false
|
72
106
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
107
|
requirements:
|
75
|
-
- -
|
108
|
+
- - "~>"
|
76
109
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
110
|
+
version: '2.0'
|
78
111
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
112
|
+
name: ruby-prof
|
80
113
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
114
|
requirements:
|
83
|
-
- -
|
115
|
+
- - "~>"
|
84
116
|
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
117
|
+
version: '0.14'
|
86
118
|
type: :development
|
87
119
|
prerelease: false
|
88
120
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
121
|
requirements:
|
91
|
-
- -
|
122
|
+
- - "~>"
|
92
123
|
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
description:
|
124
|
+
version: '0.14'
|
125
|
+
description: A better version of OpenStruct
|
95
126
|
email:
|
96
|
-
- kurtisrainboltgreene
|
127
|
+
- me@kurtisrainboltgreene.name
|
97
128
|
executables: []
|
98
129
|
extensions: []
|
99
130
|
extra_rdoc_files: []
|
100
131
|
files:
|
101
|
-
- .gitignore
|
102
|
-
- .rvmrc
|
103
|
-
- .travis.yml
|
104
|
-
- Gemfile
|
105
|
-
- Guardfile
|
106
|
-
- LICENSE
|
107
|
-
- README.md
|
108
|
-
- Rakefile
|
109
|
-
- astruct.gemspec
|
110
|
-
- bench/add_more_vs_ostruct.rb
|
111
|
-
- bench/delete_vs_ostruct.rb
|
112
|
-
- bench/dump_vs_ostruct.rb
|
113
|
-
- bench/dynamic_vs_ostruct.rb
|
114
|
-
- bench/inspect_vs_ostruct.rb
|
115
|
-
- bench/load_vs_ostruct.rb
|
116
|
-
- bench/nested_vs_ostruct.rb
|
117
|
-
- bench/new_vs_ostruct.rb
|
118
|
-
- bench/some_updates_vs_ostruct.rb
|
119
132
|
- lib/astruct.rb
|
120
|
-
- lib/astruct/
|
133
|
+
- lib/astruct/behavior.rb
|
121
134
|
- lib/astruct/version.rb
|
122
|
-
-
|
123
|
-
-
|
124
|
-
-
|
125
|
-
|
126
|
-
|
135
|
+
- spec/lib/astruct/behavior_spec.rb
|
136
|
+
- spec/lib/astruct/version_spec.rb
|
137
|
+
- spec/lib/astruct_spec.rb
|
138
|
+
- spec/spec_helper.rb
|
139
|
+
- test/lib/astruct/test_behavior.rb
|
140
|
+
- test/test_helper.rb
|
141
|
+
homepage: http://krainboltgreene.github.io/astruct.gem
|
142
|
+
licenses:
|
143
|
+
- MIT
|
144
|
+
metadata: {}
|
127
145
|
post_install_message:
|
128
146
|
rdoc_options: []
|
129
147
|
require_paths:
|
130
148
|
- lib
|
131
149
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
-
none: false
|
133
150
|
requirements:
|
134
|
-
- -
|
151
|
+
- - ">="
|
135
152
|
- !ruby/object:Gem::Version
|
136
153
|
version: '0'
|
137
|
-
segments:
|
138
|
-
- 0
|
139
|
-
hash: -3183751075223347111
|
140
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
-
none: false
|
142
155
|
requirements:
|
143
|
-
- -
|
156
|
+
- - ">="
|
144
157
|
- !ruby/object:Gem::Version
|
145
158
|
version: '0'
|
146
|
-
segments:
|
147
|
-
- 0
|
148
|
-
hash: -3183751075223347111
|
149
159
|
requirements: []
|
150
160
|
rubyforge_project:
|
151
|
-
rubygems_version:
|
161
|
+
rubygems_version: 2.4.6
|
152
162
|
signing_key:
|
153
|
-
specification_version:
|
154
|
-
summary:
|
163
|
+
specification_version: 4
|
164
|
+
summary: A better version of OpenStruct
|
155
165
|
test_files:
|
156
|
-
- test/
|
157
|
-
- test/
|
158
|
-
-
|
166
|
+
- test/lib/astruct/test_behavior.rb
|
167
|
+
- test/test_helper.rb
|
168
|
+
- spec/lib/astruct/behavior_spec.rb
|
169
|
+
- spec/lib/astruct/version_spec.rb
|
170
|
+
- spec/lib/astruct_spec.rb
|
171
|
+
- spec/spec_helper.rb
|
159
172
|
has_rdoc:
|
data/.gitignore
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
-
#
|
3
|
-
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
-
# or operating system, you probably want to add a global ignore instead:
|
5
|
-
# git config --global core.excludesfile ~/.gitignore
|
6
|
-
|
7
|
-
# Ignore all of the generated gem stuff
|
8
|
-
/pkg
|
9
|
-
/*.gem
|
10
|
-
|
11
|
-
# Ignore bundler config
|
12
|
-
/.bundle
|
13
|
-
/Gemfile.lock
|
14
|
-
|
15
|
-
# Ignore all bundler caching
|
16
|
-
/vendor/cache
|
17
|
-
/vendor/ruby
|
18
|
-
|
19
|
-
# Ignore all tempfiles
|
20
|
-
/tmp
|
21
|
-
|
22
|
-
# Ignores that should be in the global gitignore
|
23
|
-
# /*.rbc
|
24
|
-
# /.config
|
25
|
-
/.yardoc
|
26
|
-
# /InstalledFiles
|
27
|
-
/_yardoc
|
28
|
-
/coverage/
|
29
|
-
/doc/
|
30
|
-
# /lib/bundler/man/
|
31
|
-
# /rdoc/
|
32
|
-
# /spec/reports/
|
33
|
-
# /test/tmp/
|
34
|
-
# /test/version_tmp/
|
data/.rvmrc
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
-
# development environment upon cd'ing into the directory
|
5
|
-
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
-
# Only full ruby name is supported here, for short names use:
|
8
|
-
# echo "rvm use 1.9.3" > .rvmrc
|
9
|
-
environment_id="ruby-1.9.3-p286@astruct"
|
10
|
-
|
11
|
-
# Uncomment the following lines if you want to verify rvm version per project
|
12
|
-
# rvmrc_rvm_version="1.16.17 (stable)" # 1.10.1 seams as a safe start
|
13
|
-
|
14
|
-
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
15
|
-
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
16
|
-
# return 1
|
17
|
-
# }
|
18
|
-
|
19
|
-
# First we attempt to load the desired environment directly from the environment
|
20
|
-
# file. This is very fast and efficient compared to running through the entire
|
21
|
-
# CLI and selector. If you want feedback on which environment was used then
|
22
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
23
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
24
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
25
|
-
then
|
26
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
27
|
-
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
28
|
-
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
29
|
-
else
|
30
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
31
|
-
rvm --create "$environment_id" || {
|
32
|
-
echo "Failed to create RVM environment '${environment_id}'."
|
33
|
-
return 1
|
34
|
-
}
|
35
|
-
fi
|
36
|
-
|
37
|
-
# If you use bundler, this might be useful to you:
|
38
|
-
# if [[ -s Gemfile ]] && {
|
39
|
-
# ! builtin command -v bundle >/dev/null ||
|
40
|
-
# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
|
41
|
-
# }
|
42
|
-
# then
|
43
|
-
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
44
|
-
# gem install bundler
|
45
|
-
# fi
|
46
|
-
# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
|
47
|
-
# then
|
48
|
-
# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
|
49
|
-
# fi
|
data/.travis.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
- 1.9.3
|
data/Gemfile
DELETED
data/Guardfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
guard 'minitest' do
|
5
|
-
# with Minitest::Unit
|
6
|
-
watch(%r|^test/test_(.*)\.rb|)
|
7
|
-
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
8
|
-
watch(%r|^test/test_helper\.rb|) { "test" }
|
9
|
-
|
10
|
-
# with Minitest::Spec
|
11
|
-
# watch(%r|^spec/(.*)_spec\.rb|)
|
12
|
-
# watch(%r|^lib/(.*)\.rb|) { |m| "spec/#{m[1]}_spec.rb" }
|
13
|
-
# watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
14
|
-
end
|
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2012 Kurtis Rainbolt-Greene
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# Astruct
|
2
|
-
|
3
|
-
AltStruct is a direct alternative to OpenStruct, the Ruby stdlibrary.
|
4
|
-
|
5
|
-
In some cases AltStruct is slower than OpenStruct, especially on incredibly large keys.
|
6
|
-
|
7
|
-
|
8
|
-
## Installation
|
9
|
-
|
10
|
-
Add this line to your application's Gemfile:
|
11
|
-
|
12
|
-
gem 'astruct'
|
13
|
-
|
14
|
-
And then execute:
|
15
|
-
|
16
|
-
$ bundle
|
17
|
-
|
18
|
-
Or install it yourself as:
|
19
|
-
|
20
|
-
$ gem install astruct
|
21
|
-
|
22
|
-
## Usage
|
23
|
-
|
24
|
-
TODO: Write usage instructions here
|
25
|
-
|
26
|
-
## Contributing
|
27
|
-
|
28
|
-
1. Fork it
|
29
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
31
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
32
|
-
5. Create new Pull Request
|
data/Rakefile
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'bundler/gem_tasks'
|
3
|
-
require 'rake/clean'
|
4
|
-
require 'rake/testtask'
|
5
|
-
require 'yard'
|
6
|
-
|
7
|
-
begin
|
8
|
-
Bundler.setup :default, :development
|
9
|
-
rescue Bundler::BundlerError => error
|
10
|
-
$stderr.puts error.message
|
11
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
12
|
-
exit error.status_code
|
13
|
-
end
|
14
|
-
|
15
|
-
Bundler::GemHelper.install_tasks
|
16
|
-
|
17
|
-
desc "Run all of the tests"
|
18
|
-
Rake::TestTask.new do |config|
|
19
|
-
config.libs << 'test'
|
20
|
-
config.pattern = 'test/**/*_test*'
|
21
|
-
config.verbose = true
|
22
|
-
config.warning = true
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "Generate all of the docs"
|
26
|
-
YARD::Rake::YardocTask.new do |config|
|
27
|
-
config.files = Dir['lib/**/*.rb']
|
28
|
-
end
|
29
|
-
|
30
|
-
desc "Running all the benchmarks and writing results to file"
|
31
|
-
task :bench do
|
32
|
-
Dir[File.join(File.dirname(__FILE__), "bench", "*")].each do |benchmark|
|
33
|
-
header = "\nPLATFORM: #{RUBY_DESCRIPTION}\nTIMESTAMP: #{Time.now}\n---\n"
|
34
|
-
results = `bundle exec ruby #{benchmark}`
|
35
|
-
document = header + results
|
36
|
-
File.open benchmark, "a" do |file|
|
37
|
-
file.write document.gsub /^/, "# "
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
desc 'Default: run tests, and generate docs'
|
43
|
-
task :default => [ :test, :yard ]
|