-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
49 lines (30 loc) · 1.44 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
***** INSTRUCTIONS *****
Install the bundler gem.
$ gem install bundler
Then run the following command:
$ bundle install
This will allow ruby to fetch the gems for for the test environment
(Rspec) and debugging (pry).
The code can be run in 2 ways:
A) From the root folder run the command:
$ ruby match_finder.rb
The program will ask for the text and sub text to match.
Because of the gets.chomp method used, the inputs will always be string.
B) From within the /lib folder, run a Ruby Shell such a IRB or Pry(previously
installed via bundler).
Once inside the ruby shell, run the following:
> require_relative 'word_matcher'
The shell will log:
> true
Now proceed to create a new instance of the Class WordMatchFinder giving it
as arguments: the text and sub text to be matched.
Both arguments have to be String object. If failing to do so the code will run a custom error
inviting the user to use Strings as arguments.
Run something similar to the following in your ruby shell:
> test = WordMatchFinder.new("ciao, come stai oggi?oggi sto bene grazie, ciao", "st")
PS: Translation of the string from Italian is : "Hi, how are you today? Today I am fine thanks, goodbye"
Then run the instance method .find_match on the newly created instance.
> test.find_match
By calling the setters .text and .sub_text, it is possible to change the instance variables and proceed on new tests.
> test.text = "Hi, how are you today?"
> test.sub_text = "are"