pry-send_tweet.rb 0.7.0 → 0.8.0
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/CHANGELOG.md +5 -1
- data/README.md +20 -0
- data/lib/pry-send_tweet.rb +19 -0
- data/lib/pry/send_tweet/commands/base_command.rb +1 -9
- data/lib/pry/send_tweet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ce2553fea351dc038a90454aab0c8fea7ba8a68116f20732d1f4ac06287e241
|
4
|
+
data.tar.gz: 8d7a7a9a77a2ed1c392d508ac64cbfa7daaafa7975c0667fa72b8257fdd595f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ce626ae62a433641ae6939e61ae8e8ff597d88e881c0e722786ca3d180c44c7bf4712e2e8f265f62952189b6f13afbb68d7aba2c62c9ba00a358d31746c4ec
|
7
|
+
data.tar.gz: 000dca566ec219b81d8ce3470e38b3d6f3a46688032c8831bb1f409dac235d339884b4e9686258cadc5046206d7de661b71f5eddadae9223df9da26eead6270c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
* [Profile Actions](#profile-actions)
|
14
14
|
* [Twitter Suggestions](#twitter-suggestions)
|
15
15
|
* [Muting other users](#muting-other-users)
|
16
|
+
* [Sticky local variable: `_twitter_` ](#special-variable-_twitter_)
|
16
17
|
* [Tip: Command Aliases](#tip)
|
17
18
|
* [Multi-tasking: tmux / screen](#multi-tasking)
|
18
19
|
* [Install](#install)
|
@@ -218,6 +219,25 @@ The `twitter-search` command can be used to search Twitter.
|
|
218
219
|
|
219
220
|
[1] pry(main)> on-twitter --unmute-user=user1,user2,user3
|
220
221
|
|
222
|
+
|
223
|
+
### <a id='special-variable-_twitter_'>Sticky local variable: `_twitter_`</a>
|
224
|
+
|
225
|
+
The local variable `_twitter_` is inserted into the active Binding, providing
|
226
|
+
a programmable API accessible to Ruby code as well as a lower level of access to
|
227
|
+
the Twitter API. It is meant for exploration, development, and debugging. The local
|
228
|
+
variable is considered reserved, if another local variable of the same name is set
|
229
|
+
in the same Binding, expect unusual behaviour.
|
230
|
+
|
231
|
+
The local variable returns an instance of `Twitter::REST::Client`:
|
232
|
+
|
233
|
+
[1] pry(main)> _twitter_
|
234
|
+
=> #<Twitter::REST::Client:0x00007ff44cd6dce0
|
235
|
+
@access_token="xxx",
|
236
|
+
@access_token_secret="xxx",
|
237
|
+
@consumer_key="xxx",
|
238
|
+
@consumer_secret="xxx",
|
239
|
+
@user_agent="pry-send_tweet.rb v0.7.0">
|
240
|
+
|
221
241
|
### <a id='tip'>Tip: Command Aliases</a>
|
222
242
|
|
223
243
|
When there are Twitter accounts you read often, it can turn out to be faster
|
data/lib/pry-send_tweet.rb
CHANGED
@@ -30,3 +30,22 @@ class Pry
|
|
30
30
|
require_relative 'pry/send_tweet/commands/twitter_action'
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
Pry.configure do |config|
|
35
|
+
b = lambda do |*ary|
|
36
|
+
pry = ary[-1]
|
37
|
+
twitter = Twitter::REST::Client.new {|config|
|
38
|
+
config.consumer_key = pry.config.twitter.consumer_key
|
39
|
+
config.consumer_secret = pry.config.twitter.consumer_secret
|
40
|
+
config.access_token = pry.config.twitter.access_token
|
41
|
+
config.access_token_secret = pry.config.twitter.access_token_secret
|
42
|
+
}.tap {|twitter|
|
43
|
+
twitter.user_agent = pry.config.twitter.user_agent ||
|
44
|
+
"pry-send_tweet.rb v#{Pry::SendTweet::VERSION}"
|
45
|
+
}
|
46
|
+
target = pry.binding_stack[-1]
|
47
|
+
target.local_variable_set :_twitter_, twitter
|
48
|
+
end
|
49
|
+
config.hooks.add_hook(:before_eval, 'pry_send_tweets_before_eval', b)
|
50
|
+
config.hooks.add_hook(:before_session, 'pry_send_tweets_before_session', b)
|
51
|
+
end
|
@@ -56,14 +56,6 @@ class Pry::SendTweet::BaseCommand < Pry::ClassCommand
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def twitter
|
59
|
-
@twitter ||=
|
60
|
-
config.consumer_key = _pry_.config.twitter.consumer_key
|
61
|
-
config.consumer_secret = _pry_.config.twitter.consumer_secret
|
62
|
-
config.access_token = _pry_.config.twitter.access_token
|
63
|
-
config.access_token_secret = _pry_.config.twitter.access_token_secret
|
64
|
-
}.tap {|twitter|
|
65
|
-
twitter.user_agent = _pry_.config.twitter.user_agent ||
|
66
|
-
"pry-send_tweet.rb v#{Pry::SendTweet::VERSION}"
|
67
|
-
}
|
59
|
+
@twitter ||= _pry_.binding_stack[-1].eval('_twitter_')
|
68
60
|
end
|
69
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-send_tweet.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gleeson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|