I
I
idin2016-01-20 23:00:52
ruby
idin, 2016-01-20 23:00:52

How to call standard gem commands not through the terminal, but in the program code?

This means the script is executed and along the way it offers to install the gem

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mukizu, 2016-01-21
@Izy

system("gem install rails")
For example, but to do so, I would not advise.
You are trying to use some kind of gem, if not, inform the user about it, let him install it. Putting modules for him is not ice, to put it mildly.

E
Evgeny Kungurov, 2016-01-21
@evgenykungurov

You read at least the basics. Read at least one book and read online resources.
On the topic, you include the gem in the same way as in the terminal, first require 'gem_name'
Then work with it like GemName::Class.method, or Class.new, you can include all the methods in your file using the include method directly in your class.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question