open 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of open might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +285 -0
- data/bin/nano_open +7 -0
- data/bin/open +7 -0
- data/bin/open_in_browser +7 -0
- data/bin/open_these_files +7 -0
- data/bin/open_with_delay +7 -0
- data/doc/README.gen +241 -0
- data/lib/open/base/base.rb +288 -0
- data/lib/open/constants/constants.rb +110 -0
- data/lib/open/in_browser/in_browser.rb +567 -0
- data/lib/open/in_editor/in_editor.rb +316 -0
- data/lib/open/last/last.rb +143 -0
- data/lib/open/last_url/last_url.rb +149 -0
- data/lib/open/nano_open/nano_open.rb +73 -0
- data/lib/open/open.rb +999 -0
- data/lib/open/project/project.rb +45 -0
- data/lib/open/requires/require_the_project.rb +15 -0
- data/lib/open/these_files/these_files.rb +116 -0
- data/lib/open/toplevel_code/toplevel_code.rb +162 -0
- data/lib/open/version/version.rb +19 -0
- data/lib/open/with_delay/with_delay.rb +261 -0
- data/lib/open/yaml/use_this_browser.yml +1 -0
- data/lib/open/yaml/use_this_editor.yml +1 -0
- data/lib/open.rb +5 -0
- data/open.gemspec +36 -0
- data/test/testing_open.rb +35 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f8f567bdef7c3cb56c38949cf64bb73bc0180aeb4ad1c1bdac3f24aa55e356a5
|
4
|
+
data.tar.gz: 9c55062ff19bf9a69e0f8a53dd868b4d848572bc2f24f01ac60a2ca1c3a2966e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f0a0441a570e2962ccd8a5201910a760e70a5aedba084af17407a5f5f170aad4f6420c894cef5fc8a2e1b6a2c424a6429641b55a183904a4f3a54427969d986a
|
7
|
+
data.tar.gz: 44db8e4d30053712bba9f16d6b9788d931f102e43cc2ae28e395d7c3daacc0a475bb98efcbfd4d65baec883752a8a34e9c0bdaba22883c5b34d567a6e61a1435
|
data/README.md
ADDED
@@ -0,0 +1,285 @@
|
|
1
|
+
[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
|
2
|
+
[![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/open.svg)](https://badge.fury.io/rb/open)
|
4
|
+
|
5
|
+
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">17.07.2022</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">18:53:18</span> o'clock.
|
6
|
+
|
7
|
+
## History of this project
|
8
|
+
|
9
|
+
In the past I used separate projects / gems, such as **OpenInEditor** or
|
10
|
+
**OpenInBrowser**, to open files via my favourite editor, or to open
|
11
|
+
remote URLs via my favourite browser.
|
12
|
+
|
13
|
+
Additionally I also had more code aggregated in **roebe/classes/open/**.
|
14
|
+
|
15
|
+
This slightly confusing situation accrued over the years, from 2010 to 2021
|
16
|
+
or so.
|
17
|
+
|
18
|
+
In early **September 2021** I reconsidered the old approach.
|
19
|
+
|
20
|
+
I wanted to not only clean up the old code base, making it more flexible
|
21
|
+
as well in the process, but **add a new API** such as:
|
22
|
+
|
23
|
+
Open.in_editor('/home/foobar.md')
|
24
|
+
Open.in_editor(this_file: '/home/foobar.md')
|
25
|
+
|
26
|
+
As well as:
|
27
|
+
|
28
|
+
Open.in_browser(url: 'google.de', browser: 'firefox')
|
29
|
+
|
30
|
+
That way we can 'think' of "Open" first, and then simply call
|
31
|
+
the method name that we want to use. On the commandline we can
|
32
|
+
still do:
|
33
|
+
|
34
|
+
open_in_editor foobar.rb
|
35
|
+
open_in_browser google.de
|
36
|
+
|
37
|
+
## Layout of the project's structure
|
38
|
+
|
39
|
+
This subsection will not include all details, but may serve as a slight
|
40
|
+
introduction to how the project is layout.
|
41
|
+
|
42
|
+
Most of the constants will reside under **open/constants/constants.rb**.
|
43
|
+
|
44
|
+
Toplevel-methods can be found under **open/toplevel_code/** for the
|
45
|
+
most part. This may be ignored by some classes if they add
|
46
|
+
toplevel-methods; in that case the toplevel may be modified by such
|
47
|
+
a class, and **can subsequently be found in that .rb file where the
|
48
|
+
class is defined** (or the directory, if this class is split up
|
49
|
+
into several different .rb files).
|
50
|
+
|
51
|
+
So, for instance, **class Open::Browser** may define a toplevel
|
52
|
+
method called **Open.in_browser()**. You can also **grep** (on Linux)
|
53
|
+
for where the source code resides specifically, of course.
|
54
|
+
|
55
|
+
## Optional dependencies in this project
|
56
|
+
|
57
|
+
Officially there are no hardcoded dependencies in this project.
|
58
|
+
|
59
|
+
However had, you are encouraged to install various gems, such as:
|
60
|
+
|
61
|
+
- colours
|
62
|
+
- convert_global_env
|
63
|
+
- beautiful_url
|
64
|
+
- opn
|
65
|
+
|
66
|
+
These may enhance the ruby code used in this project.
|
67
|
+
|
68
|
+
I highly recommend to install the **colours** gem, but ultimately
|
69
|
+
the code in this project is written deliberately in a manner to
|
70
|
+
make all these add-ons optional, so this is entirely up to you
|
71
|
+
in the end.
|
72
|
+
|
73
|
+
## class Open::InEditor
|
74
|
+
|
75
|
+
This class can be used for **opening a (local) file via the editor**.
|
76
|
+
|
77
|
+
To open a local file via the open-gem, do:
|
78
|
+
|
79
|
+
require 'open'
|
80
|
+
|
81
|
+
Open.in_editor('FILE_PATH_GOES_IN_HERE')
|
82
|
+
Open.in_editor('/home/x/programming/ruby/src/open/open.gemspec')
|
83
|
+
|
84
|
+
## class Open::InBrowser
|
85
|
+
|
86
|
+
This class can be used for opening a remote URL via your
|
87
|
+
favourite **browser**.
|
88
|
+
|
89
|
+
Upon requiring the main class, the method called:
|
90
|
+
|
91
|
+
open_in_browser()
|
92
|
+
|
93
|
+
will be defined as well, to simplify working with the
|
94
|
+
class.
|
95
|
+
|
96
|
+
To specify a particular **port**, use this variant:
|
97
|
+
|
98
|
+
Open.open_in_browser(port: 8080)
|
99
|
+
|
100
|
+
This is equivalent to this variant here:
|
101
|
+
|
102
|
+
PORT_TO_USE = 8080
|
103
|
+
Open.in_browser(with_localhost: PORT_TO_USE)
|
104
|
+
|
105
|
+
So **different keywords** can be used, however your brain prefers
|
106
|
+
this or that variant.
|
107
|
+
|
108
|
+
In **February 2022** I discovered the **launchy** gem. This gem
|
109
|
+
can be used to open a remote URL via your favourite browser
|
110
|
+
too. Since that is a rather neat functionality to have, I
|
111
|
+
decided to integrate this as an optional API into the
|
112
|
+
**open** gem as well.
|
113
|
+
|
114
|
+
Open.open_in_browser(port: 8080, use_launchy: true)
|
115
|
+
# or this variant
|
116
|
+
Open.open_in_browser(port: 8080) { :use_launchy }
|
117
|
+
|
118
|
+
Note that in order for this to work, e. g. to use **:use_launchy**
|
119
|
+
such as shown by the last example, you need to have the launchy
|
120
|
+
gem installed, logically.
|
121
|
+
|
122
|
+
On windows you can open a remote URL via firefox in the following
|
123
|
+
manner:
|
124
|
+
|
125
|
+
start firefox website_here
|
126
|
+
start firefox blog.fefe.de
|
127
|
+
start firefox www.howtogeek.com
|
128
|
+
start firefox -new-tab www.howtogeek.com
|
129
|
+
|
130
|
+
In particular the latter variant can be used as-is via
|
131
|
+
cmd.exe. You can also pass the **/k** flag to spawn a
|
132
|
+
new cmd.exe, on windows. Before knowing that I used
|
133
|
+
the system() approach passing the path to firefox.exe,
|
134
|
+
but that did not work. Via **start**, though, it does
|
135
|
+
indeed work.
|
136
|
+
|
137
|
+
## class Open::LastUrl
|
138
|
+
|
139
|
+
This small class can be used to specifically open the content
|
140
|
+
of the xorg-buffer via the browser.
|
141
|
+
|
142
|
+
## class Open::WithDelay
|
143
|
+
|
144
|
+
You can open files via a <b>delay</b>, through class **Open::WithDelay**.
|
145
|
+
|
146
|
+
You can specify a delay via:
|
147
|
+
|
148
|
+
openwithdelay 3
|
149
|
+
|
150
|
+
Or via the method:
|
151
|
+
|
152
|
+
.set_use_this_delay()
|
153
|
+
.set_use_this_delay(3)
|
154
|
+
.set_use_this_delay(0.5)
|
155
|
+
|
156
|
+
Why may this be necessary? My old editor (called bluefish) has had
|
157
|
+
problems batch-opening many files, so I needed a delay. With a delay
|
158
|
+
in place the problem I saw went away. So this was mostly 'workaround'
|
159
|
+
code.
|
160
|
+
|
161
|
+
## Changing to a different default editor and browser
|
162
|
+
|
163
|
+
In **November 2021** I realized that we need a way to more
|
164
|
+
easily switch between the default main editor and the
|
165
|
+
default main browser. For instance, I abandoned palemoon,
|
166
|
+
so I needed to use firefox quickly.
|
167
|
+
|
168
|
+
The old code had hardcoded calls to **palemoon**, which was
|
169
|
+
not very elegant, and made changes to the code harder
|
170
|
+
naturally.
|
171
|
+
|
172
|
+
Thus <b>two new yaml files</b> were added to the gem:
|
173
|
+
|
174
|
+
use_this_browser.yml
|
175
|
+
use_this_editor.yml
|
176
|
+
|
177
|
+
Now you can modify these yaml files and use a different
|
178
|
+
browser or editor. You can even specify the full path
|
179
|
+
to these browsers and it should work fine.
|
180
|
+
|
181
|
+
In July 2022 I decided to extend this functionality.
|
182
|
+
|
183
|
+
First, you can now <b>automatically</b> set a new
|
184
|
+
browser via the toplevel method
|
185
|
+
<b>Open.permanently_use_this_browser()</b>.
|
186
|
+
|
187
|
+
Simply pass the new browser as name to the method,
|
188
|
+
such as:
|
189
|
+
|
190
|
+
Open.permanently_use_this_browser('thorium') # if you want to use the thorium browser
|
191
|
+
|
192
|
+
The second argument is optional and allows the user to
|
193
|
+
specify another .yml file to use. The default value
|
194
|
+
should be fine for most users, though, in perhaps
|
195
|
+
99.9% of the use cases.
|
196
|
+
|
197
|
+
Note that the **save_file** gem is required for this
|
198
|
+
functionality.
|
199
|
+
|
200
|
+
Note that you can also place a file called
|
201
|
+
<b>use_this_browser.yml</b> in your home directory -
|
202
|
+
the home directory can be queried via <b>Dir.home</b>.
|
203
|
+
This .yml file, should it exist, will be checked
|
204
|
+
first. That way you can simply assign a new default
|
205
|
+
value without having to modify the internal .yml
|
206
|
+
files of this project.
|
207
|
+
|
208
|
+
## Finding out the current editor and browser in use
|
209
|
+
|
210
|
+
Use the following two methods if you wish to find out which
|
211
|
+
is the current main editor and the current main browser in use.
|
212
|
+
|
213
|
+
puts Open.use_which_editor?
|
214
|
+
puts Open.use_which_browser? # Or the shorter alias: Open.browser?
|
215
|
+
|
216
|
+
Both values can be changed for your own use case. For instance,
|
217
|
+
if you would like to change the browser to be used, use either
|
218
|
+
of the following two methods:
|
219
|
+
|
220
|
+
Open.set_use_this_browser
|
221
|
+
Open.use_this_browser=
|
222
|
+
|
223
|
+
Currently, as of <b>July 2022</b>, the following browsers have
|
224
|
+
been tested and "integrated":
|
225
|
+
|
226
|
+
firefox
|
227
|
+
palemoon
|
228
|
+
chromium
|
229
|
+
thorium
|
230
|
+
|
231
|
+
More may be added in the future. Note that "integrated" mostly
|
232
|
+
means tested on my home system. Each of these may use a
|
233
|
+
slightly different way to open a remote URL in a tab, so
|
234
|
+
the syntax has to be adjusted to each browser differently.
|
235
|
+
|
236
|
+
## class Open::Base
|
237
|
+
|
238
|
+
This subsection contains just a few pointers to the class
|
239
|
+
called **Open::Base**.
|
240
|
+
|
241
|
+
The method **.this_file_was_not_found()** can be used to
|
242
|
+
designate that a certain file (the input argument to
|
243
|
+
that method) could <b>not</b> be found.
|
244
|
+
|
245
|
+
|
246
|
+
## Contact information and mandatory 2FA coming up in 2022
|
247
|
+
|
248
|
+
If your creative mind has ideas and specific suggestions to make this gem
|
249
|
+
more useful in general, feel free to drop me an email at any time, via:
|
250
|
+
|
251
|
+
shevy@inbox.lt
|
252
|
+
|
253
|
+
Before that email I used an email account at Google gmail, but in **2021** I
|
254
|
+
decided to slowly abandon gmail for various reasons. In order to limit this
|
255
|
+
explanation here, allow me to just briefly state that I do not feel as if I
|
256
|
+
want to promote any Google service anymore, for various reasons.
|
257
|
+
|
258
|
+
Do keep in mind that responding to emails may take some time, depending on
|
259
|
+
the amount of work I may have at that moment.
|
260
|
+
|
261
|
+
In 2022 rubygems.org decided to make 2FA mandatory for every gem owner:
|
262
|
+
see https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
|
263
|
+
|
264
|
+
As I can not use 2FA, for reasons I will skip explaining here (see
|
265
|
+
various github issue discussions in the past), this effectively means that
|
266
|
+
Betty Li and others who run the show at rubygems.org will perma-ban me
|
267
|
+
from using rubygems as a developer.
|
268
|
+
|
269
|
+
As I disagree with that decision completely, this will mean that all my
|
270
|
+
gems will be removed from rubygems.org prior to that sunset date, e. g.
|
271
|
+
before they permanently lock me out from the code that I used
|
272
|
+
to maintain. It is pointless to want to discuss this with them anymore -
|
273
|
+
they have made up their minds and decided that you can only use
|
274
|
+
the code if 2FA is in place, even though the code itself works just
|
275
|
+
fine. If you don't use 2FA you are effectively locked out from your
|
276
|
+
own code; I consider this a malicious attack. See also how they limited
|
277
|
+
discussions to people with mandatory 2FA on the ruby-bugtracker, thus
|
278
|
+
banning everyone permanently without 2FA:
|
279
|
+
|
280
|
+
https://bugs.ruby-lang.org/issues/18800
|
281
|
+
|
282
|
+
Guess it may indeed be time to finally abandon ruby - not because
|
283
|
+
ruby is a bad language, but there are people now in charge who
|
284
|
+
really should not be part of ruby in the first place.
|
285
|
+
|
data/bin/nano_open
ADDED
data/bin/open
ADDED
data/bin/open_in_browser
ADDED
data/bin/open_with_delay
ADDED
data/doc/README.gen
ADDED
@@ -0,0 +1,241 @@
|
|
1
|
+
ADD_DEFAULT_HEADER
|
2
|
+
|
3
|
+
## History of this project
|
4
|
+
|
5
|
+
In the past I used separate projects / gems, such as **OpenInEditor** or
|
6
|
+
**OpenInBrowser**, to open files via my favourite editor, or to open
|
7
|
+
remote URLs via my favourite browser.
|
8
|
+
|
9
|
+
Additionally I also had more code aggregated in **roebe/classes/open/**.
|
10
|
+
|
11
|
+
This slightly confusing situation accrued over the years, from 2010 to 2021
|
12
|
+
or so.
|
13
|
+
|
14
|
+
In early **September 2021** I reconsidered the old approach.
|
15
|
+
|
16
|
+
I wanted to not only clean up the old code base, making it more flexible
|
17
|
+
as well in the process, but **add a new API** such as:
|
18
|
+
|
19
|
+
Open.in_editor('/home/foobar.md')
|
20
|
+
Open.in_editor(this_file: '/home/foobar.md')
|
21
|
+
|
22
|
+
As well as:
|
23
|
+
|
24
|
+
Open.in_browser(url: 'google.de', browser: 'firefox')
|
25
|
+
|
26
|
+
That way we can 'think' of "Open" first, and then simply call
|
27
|
+
the method name that we want to use. On the commandline we can
|
28
|
+
still do:
|
29
|
+
|
30
|
+
open_in_editor foobar.rb
|
31
|
+
open_in_browser google.de
|
32
|
+
|
33
|
+
## Layout of the project's structure
|
34
|
+
|
35
|
+
This subsection will not include all details, but may serve as a slight
|
36
|
+
introduction to how the project is layout.
|
37
|
+
|
38
|
+
Most of the constants will reside under **open/constants/constants.rb**.
|
39
|
+
|
40
|
+
Toplevel-methods can be found under **open/toplevel_code/** for the
|
41
|
+
most part. This may be ignored by some classes if they add
|
42
|
+
toplevel-methods; in that case the toplevel may be modified by such
|
43
|
+
a class, and **can subsequently be found in that .rb file where the
|
44
|
+
class is defined** (or the directory, if this class is split up
|
45
|
+
into several different .rb files).
|
46
|
+
|
47
|
+
So, for instance, **class Open::Browser** may define a toplevel
|
48
|
+
method called **Open.in_browser()**. You can also **grep** (on Linux)
|
49
|
+
for where the source code resides specifically, of course.
|
50
|
+
|
51
|
+
## Optional dependencies in this project
|
52
|
+
|
53
|
+
Officially there are no hardcoded dependencies in this project.
|
54
|
+
|
55
|
+
However had, you are encouraged to install various gems, such as:
|
56
|
+
|
57
|
+
- colours
|
58
|
+
- convert_global_env
|
59
|
+
- beautiful_url
|
60
|
+
- opn
|
61
|
+
|
62
|
+
These may enhance the ruby code used in this project.
|
63
|
+
|
64
|
+
I highly recommend to install the **colours** gem, but ultimately
|
65
|
+
the code in this project is written deliberately in a manner to
|
66
|
+
make all these add-ons optional, so this is entirely up to you
|
67
|
+
in the end.
|
68
|
+
|
69
|
+
## class Open::InEditor
|
70
|
+
|
71
|
+
This class can be used for **opening a (local) file via the editor**.
|
72
|
+
|
73
|
+
To open a local file via the open-gem, do:
|
74
|
+
|
75
|
+
require 'open'
|
76
|
+
|
77
|
+
Open.in_editor('FILE_PATH_GOES_IN_HERE')
|
78
|
+
Open.in_editor('/home/x/programming/ruby/src/open/open.gemspec')
|
79
|
+
|
80
|
+
## class Open::InBrowser
|
81
|
+
|
82
|
+
This class can be used for opening a remote URL via your
|
83
|
+
favourite **browser**.
|
84
|
+
|
85
|
+
Upon requiring the main class, the method called:
|
86
|
+
|
87
|
+
open_in_browser()
|
88
|
+
|
89
|
+
will be defined as well, to simplify working with the
|
90
|
+
class.
|
91
|
+
|
92
|
+
To specify a particular **port**, use this variant:
|
93
|
+
|
94
|
+
Open.open_in_browser(port: 8080)
|
95
|
+
|
96
|
+
This is equivalent to this variant here:
|
97
|
+
|
98
|
+
PORT_TO_USE = 8080
|
99
|
+
Open.in_browser(with_localhost: PORT_TO_USE)
|
100
|
+
|
101
|
+
So **different keywords** can be used, however your brain prefers
|
102
|
+
this or that variant.
|
103
|
+
|
104
|
+
In **February 2022** I discovered the **launchy** gem. This gem
|
105
|
+
can be used to open a remote URL via your favourite browser
|
106
|
+
too. Since that is a rather neat functionality to have, I
|
107
|
+
decided to integrate this as an optional API into the
|
108
|
+
**open** gem as well.
|
109
|
+
|
110
|
+
Open.open_in_browser(port: 8080, use_launchy: true)
|
111
|
+
# or this variant
|
112
|
+
Open.open_in_browser(port: 8080) { :use_launchy }
|
113
|
+
|
114
|
+
Note that in order for this to work, e. g. to use **:use_launchy**
|
115
|
+
such as shown by the last example, you need to have the launchy
|
116
|
+
gem installed, logically.
|
117
|
+
|
118
|
+
On windows you can open a remote URL via firefox in the following
|
119
|
+
manner:
|
120
|
+
|
121
|
+
start firefox website_here
|
122
|
+
start firefox blog.fefe.de
|
123
|
+
start firefox www.howtogeek.com
|
124
|
+
start firefox -new-tab www.howtogeek.com
|
125
|
+
|
126
|
+
In particular the latter variant can be used as-is via
|
127
|
+
cmd.exe. You can also pass the **/k** flag to spawn a
|
128
|
+
new cmd.exe, on windows. Before knowing that I used
|
129
|
+
the system() approach passing the path to firefox.exe,
|
130
|
+
but that did not work. Via **start**, though, it does
|
131
|
+
indeed work.
|
132
|
+
|
133
|
+
## class Open::LastUrl
|
134
|
+
|
135
|
+
This small class can be used to specifically open the content
|
136
|
+
of the xorg-buffer via the browser.
|
137
|
+
|
138
|
+
## class Open::WithDelay
|
139
|
+
|
140
|
+
You can open files via a <b>delay</b>, through class **Open::WithDelay**.
|
141
|
+
|
142
|
+
You can specify a delay via:
|
143
|
+
|
144
|
+
openwithdelay 3
|
145
|
+
|
146
|
+
Or via the method:
|
147
|
+
|
148
|
+
.set_use_this_delay()
|
149
|
+
.set_use_this_delay(3)
|
150
|
+
.set_use_this_delay(0.5)
|
151
|
+
|
152
|
+
Why may this be necessary? My old editor (called bluefish) has had
|
153
|
+
problems batch-opening many files, so I needed a delay. With a delay
|
154
|
+
in place the problem I saw went away. So this was mostly 'workaround'
|
155
|
+
code.
|
156
|
+
|
157
|
+
## Changing to a different default editor and browser
|
158
|
+
|
159
|
+
In **November 2021** I realized that we need a way to more
|
160
|
+
easily switch between the default main editor and the
|
161
|
+
default main browser. For instance, I abandoned palemoon,
|
162
|
+
so I needed to use firefox quickly.
|
163
|
+
|
164
|
+
The old code had hardcoded calls to **palemoon**, which was
|
165
|
+
not very elegant, and made changes to the code harder
|
166
|
+
naturally.
|
167
|
+
|
168
|
+
Thus <b>two new yaml files</b> were added to the gem:
|
169
|
+
|
170
|
+
use_this_browser.yml
|
171
|
+
use_this_editor.yml
|
172
|
+
|
173
|
+
Now you can modify these yaml files and use a different
|
174
|
+
browser or editor. You can even specify the full path
|
175
|
+
to these browsers and it should work fine.
|
176
|
+
|
177
|
+
In July 2022 I decided to extend this functionality.
|
178
|
+
|
179
|
+
First, you can now <b>automatically</b> set a new
|
180
|
+
browser via the toplevel method
|
181
|
+
<b>Open.permanently_use_this_browser()</b>.
|
182
|
+
|
183
|
+
Simply pass the new browser as name to the method,
|
184
|
+
such as:
|
185
|
+
|
186
|
+
Open.permanently_use_this_browser('thorium') # if you want to use the thorium browser
|
187
|
+
|
188
|
+
The second argument is optional and allows the user to
|
189
|
+
specify another .yml file to use. The default value
|
190
|
+
should be fine for most users, though, in perhaps
|
191
|
+
99.9% of the use cases.
|
192
|
+
|
193
|
+
Note that the **save_file** gem is required for this
|
194
|
+
functionality.
|
195
|
+
|
196
|
+
Note that you can also place a file called
|
197
|
+
<b>use_this_browser.yml</b> in your home directory -
|
198
|
+
the home directory can be queried via <b>Dir.home</b>.
|
199
|
+
This .yml file, should it exist, will be checked
|
200
|
+
first. That way you can simply assign a new default
|
201
|
+
value without having to modify the internal .yml
|
202
|
+
files of this project.
|
203
|
+
|
204
|
+
## Finding out the current editor and browser in use
|
205
|
+
|
206
|
+
Use the following two methods if you wish to find out which
|
207
|
+
is the current main editor and the current main browser in use.
|
208
|
+
|
209
|
+
puts Open.use_which_editor?
|
210
|
+
puts Open.use_which_browser? # Or the shorter alias: Open.browser?
|
211
|
+
|
212
|
+
Both values can be changed for your own use case. For instance,
|
213
|
+
if you would like to change the browser to be used, use either
|
214
|
+
of the following two methods:
|
215
|
+
|
216
|
+
Open.set_use_this_browser
|
217
|
+
Open.use_this_browser=
|
218
|
+
|
219
|
+
Currently, as of <b>July 2022</b>, the following browsers have
|
220
|
+
been tested and "integrated":
|
221
|
+
|
222
|
+
firefox
|
223
|
+
palemoon
|
224
|
+
chromium
|
225
|
+
thorium
|
226
|
+
|
227
|
+
More may be added in the future. Note that "integrated" mostly
|
228
|
+
means tested on my home system. Each of these may use a
|
229
|
+
slightly different way to open a remote URL in a tab, so
|
230
|
+
the syntax has to be adjusted to each browser differently.
|
231
|
+
|
232
|
+
## class Open::Base
|
233
|
+
|
234
|
+
This subsection contains just a few pointers to the class
|
235
|
+
called **Open::Base**.
|
236
|
+
|
237
|
+
The method **.this_file_was_not_found()** can be used to
|
238
|
+
designate that a certain file (the input argument to
|
239
|
+
that method) could <b>not</b> be found.
|
240
|
+
|
241
|
+
ADD_CONTACT_INFORMATION
|