how to add this github project to use in ruby class [closed] - ruby

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I am learning how to use the data structure in ruby.
I found this library on github : https://github.com/kanwei/algorithms/tree/master.
I have created a word_count.rb file locally.
I want to use the library I mentioned, locally in my ruby class file.
The link I mentioned has following project structure :
how can I use this project in class file ?

It is published as a gem (just the page you found does not document that fact): https://rubygems.org/gems/algorithms
So if you have a Gemfile in your project, add the line:
gem "algorithms", "~> 0.6.1"
Otherwise, run the following command:
gem install algorithms
and use it like you would any other gem, with
require 'algorithms'
in one of your source files.

require 'algorithms'
include Containers
http://kanwei.github.io/algorithms/

Related

How can i use a library inside a podfile? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Can i use a library inside a pod file ? For example ,i would like to use some functionality from https://github.com/tonymillion/Reachability inside a pod file of this https://github.com/0xced/XCDYouTubeKit
Typically you don't modify code of external libraries. When you import something to use it in your project via CocoaPods or any other dependency manager you use items provided by the library in your project. Meaning your classes rely on some behaviour from them. You should not make external libraries depend on other external libraries but you combine their logic in your custom classes.

What does gem mean? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am struggling with the concept gem. What does it mean? On jumpstart tutorial I read this
Steve Klabnik, an instructor for Jumpstart, created the sunlight-congress gem.
http://tutorials.jumpstartlab.com/projects/eventmanager.html
What he really did? Did he created the website? Did he created a gem for a website that is already existed?
What do you do when you say
gem 'sunlight-congress'
Please Make sure I am new to programming and explain it in a simple term. I really thank you for your help
See http://guides.rubygems.org/what-is-a-gem/
a gem is kind of a library in the Ruby world, like a Maven artifact in the java world (namely a jar file with identifier and version information and more)
In Ruby, a gem is nothing but a distributed code packaged as a library created by Ruby developer(s). The idea is to keep a particular functionality of code into a library but Ruby does it more beautifully by letting Ruby developers host it on http://rubygems.org/ and library then can used by others. For more information read: http://guides.rubygems.org/what-is-a-gem/

How to package ruby application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How do you package a ruby app so all the dependencies are already packaged in the app and does not require the user to be messing about with bundler or rvm.
Use "require" for all the dependencies you need in an ordered manner.
However the require only works if the "required" package is installed on the machine. from what I know there is no automated tool .. and how do you know even "ruby" is installed (non-MacOS).
If you don't want user to "mess" with installing anything -- then you have to write a piece of code that checks the presence of dependencies and installs them if needed. .. best is to write the install script in install script/program with bash etc. or in ruby inline with something with try/end syntax.

How to use another gem dir in addition to 'lib' [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I've created a Ruby gem with the traditional 'lib' structure, but I also have another directory, say 'more' at the same level as 'lib'. However I cannot seem to access any of the methods in the 'more/*.rb' files. Can anyone tell me what needs to be done?
PS - I know from /Shopify/Liquid that they have a similar situation with 'lib' and 'performance' dirs, and there is a 'performance/shopify/liquid.rb' file and also a 'lib/performance' dir but for the life of me I cannot figure out how all that fits together. If I could resolve that then I think it would also be applicable to my solution.
From liquid's gemspec:
s.require_path = "lib"
It doesn't look like /performance is used in the gem, it's only for benchmarking and testing.
liquid/lib doesn't appear to have a performance directory. Looks like the word 'performance' is only used in the Rakefile really. Again for testing.
You can do this as well, no magic needed, it's just another directory.
If you want to include another directory as a library path, then alter the gemspec require_path value.

Stand alone ruby gem that can be installed in server [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to write a ruby gem which will act as a monitoring tool for kannel. download and install in server and start a small worker or something.How i can make this? Iam not asking the script for kannel monitoring but how to make a tool .
RailsCasts has a decent episode on making a gem with Bundler.
Bundler will handle the structure, you just need to write your application. Libraries in the /lib directory, binaries (or scripts you want to be executable) in /bin. Pretty simple!

Resources