memo-it 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/memo/it.rb +1 -1
- data/memo-it.gemspec +1 -1
- metadata +3 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc692fd05221a47c253e0ed6ab911438bc6d08f0
|
4
|
+
data.tar.gz: f5de412a7dc176141152188cded12f385ff9bcc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9083290b6f5ad32e99b825c6627fc73bc06d6c091b1e74f81abcde8c454a73cb77f6f38301cd7f510a493ca766ddfb70ae02739006d21a4769c899725c7bb3d0
|
7
|
+
data.tar.gz: 222961a4fb405fa8815d122b8d5d2ca0de1a45e6ce86b013d732290d12108804bbfc3f2afd3b3c18497343da232db1af88a1c01f5dc9d0b10b0aac44f556bad0
|
data/lib/memo/it.rb
CHANGED
data/memo-it.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["phoetmail@googlemail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{📥 📤 simple yet clever memoization helper with parameter support}
|
13
|
-
spec.description =
|
13
|
+
spec.description = spec.summary
|
14
14
|
spec.homepage = "https://github.com/phoet/memo-it"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: memo-it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- phoet
|
@@ -52,74 +52,8 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
-
description:
|
56
|
-
|
57
|
-
|
58
|
-
Clever memoization helper that uses Ruby internals instead of meta-programming.
|
59
|
-
|
60
|
-
## Usage
|
61
|
-
|
62
|
-
Requiring the gem will add a `memo` method to the `Object` class so that you can just use it like so:
|
63
|
-
|
64
|
-
```ruby
|
65
|
-
def load_stuff_from_the_web
|
66
|
-
memo do
|
67
|
-
# some expensive operation like HTTP request
|
68
|
-
# the return value of the block will be memoized
|
69
|
-
HTTPClient.get('https://github.com/phoet/memo-it')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
```
|
73
|
-
|
74
|
-
In case you want to memoize something that has parameters, memo-it will just use all local variables in scope to determine the memoization:
|
75
|
-
|
76
|
-
```ruby
|
77
|
-
def load_repo(name = 'memo-it')
|
78
|
-
memo do
|
79
|
-
# in this case the result will be memoized per name
|
80
|
-
HTTPClient.get("https://github.com/phoet/#{name}")
|
81
|
-
end
|
82
|
-
end
|
83
|
-
```
|
84
|
-
|
85
|
-
## Installation
|
86
|
-
|
87
|
-
### As a Gem
|
88
|
-
|
89
|
-
Add this line to your application's Gemfile:
|
90
|
-
|
91
|
-
```ruby
|
92
|
-
gem 'memo-it'
|
93
|
-
```
|
94
|
-
|
95
|
-
And then execute:
|
96
|
-
|
97
|
-
$ bundle
|
98
|
-
|
99
|
-
Or install it yourself as:
|
100
|
-
|
101
|
-
$ gem install memo-it
|
102
|
-
|
103
|
-
### Copy & Paste
|
104
|
-
|
105
|
-
If you don't want to include yet another Gem, just run this in your shell:
|
106
|
-
|
107
|
-
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/phoet/memo-it/master/bin/install)"
|
108
|
-
|
109
|
-
## Development
|
110
|
-
|
111
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
112
|
-
|
113
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
114
|
-
|
115
|
-
## Contributing
|
116
|
-
|
117
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/memo-it. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
118
|
-
|
119
|
-
|
120
|
-
## License
|
121
|
-
|
122
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
55
|
+
description: "\U0001F4E5 \U0001F4E4 simple yet clever memoization helper with parameter
|
56
|
+
support"
|
123
57
|
email:
|
124
58
|
- phoetmail@googlemail.com
|
125
59
|
executables: []
|