<havenwood>
Swyper: Try in irb or pry. A repl is super handy for quickly testing expressions.
<havenwood>
?irb
<ruby[bot]>
irb is "interactive ruby", it is part of ruby. You can run ruby code and see results immediately. it's useful for testing code. Also see ?pry, a gem which is a popular alternative to irb.
<havenwood>
Swyper: Just type "irb" on your command line.
<havenwood>
?pry
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<Swyper>
ah
<Swyper>
thanks
<Swyper>
I'm writing a large block of code and this is so confusing. lol
<havenwood>
Swyper: It'd work nicely with the logic flow you have.
<havenwood>
Swyper: And you can get rid of any assignment during iteration.
<Swyper>
other then rewriting the whole thing, is there another way to fix it with what I have atm?
donofrio has joined #ruby
<havenwood>
Swyper: Yes. The local variable `word` is only assigned inside your `each do |word|` block, so after the block ends that variable is undefined on line 10.
<Swyper>
what makes that nicer then the other two you showed?
<havenwood>
Swyper: If you want to remove all trailing whitespace, #strip is perfect.
<havenwood>
Swyper: The #chomp method has some interesting behavior without an argument, and there isn't a prefix version. The nice thing about #delete_prefix and #delete_suffix is they each do a straightforward thing and do it quickly and well with parity.
<havenwood>
For trailing whitespace I mean #rstrip, not #strip - typo.
<Swyper>
ah neat
<havenwood>
Swyper: Or since you know to remove the last element no matter what, removing by index is fine too!
<havenwood>
Swyper: There are many ways to do it in Ruby. :)
<Swyper>
Also another question, so I'm making small scale pure ruby written apps anyway for me to deploy them on my site ( not using rails )
<havenwood>
Swyper: There are again tons of options. You want to add Ruby to an existing webpage?
<havenwood>
Swyper: It's a plain HTML static site?
<havenwood>
Swyper: Most folk use a Rack app in Ruby land. You could direct certain pages to the Rack app. Rails is one of many Rack web frameworks (also called Rack adapters).
<Swyper>
Yeah
<Swyper>
oh neat
<havenwood>
Swyper: It's worth trying making a simple Rack app. There's almost nothing to it.
<Swyper>
http://www.rickyarora.com/ this is my site with I want to add it in their with some projects since the ones there atm are bad :P
<havenwood>
Swyper: Rails and Sinatra are the most popular.
tdy has joined #ruby
<Swyper>
interesting I'll have to look into it for sure, I'm actually going through App Academies online cirriculum and rails is something we will be learning later on and I need to get some projects up this week xD
<havenwood>
Swyper: I'd suggest making a Roda or Sinatra app and deploying it somewhere like Heroku to get started.
<havenwood>
Swyper: You can make a Rack app with this line:
<havenwood>
Swyper: It's nifty since you start with a dead simple Rack app, with just routing added. Then you compose the exact framework you need by grabbing just the plugins that make sense for your project.
millerti has quit [Read error: Connection reset by peer]
<havenwood>
Most Ruby web stuff is Rack based.
donofrio has joined #ruby
<havenwood>
There're also popular Ruby tools to generate static sites. You can use sockets directly or cgi or that sorta thing too, but most folk use Rack.
<Swyper>
interesting, thank you so much havenwood
<havenwood>
Swyper: no prob, you're welcome
tdy has quit [Remote host closed the connection]
cruzo66342 has quit [Ping timeout: 272 seconds]
ogres has joined #ruby
tdy has joined #ruby
clemens3_ has joined #ruby
kapil____ has joined #ruby
clemens3 has quit [Ping timeout: 240 seconds]
masterasia has joined #ruby
themsay has joined #ruby
sarink has joined #ruby
themsay has quit [Ping timeout: 246 seconds]
Swyper has quit [Ping timeout: 256 seconds]
roshanavand has quit [Remote host closed the connection]
roshanavand has joined #ruby
crankharder has quit [Read error: No route to host]
sarink has quit [Remote host closed the connection]
user374747474 has joined #ruby
<user374747474>
hey
darkhanb has joined #ruby
<user374747474>
having some issues with a layout
sarink has joined #ruby
user374747474 has quit [Quit: Leaving]
sarink has quit [Remote host closed the connection]
roshanavand has quit [Remote host closed the connection]
ur5us has joined #ruby
AJA4350 has quit [Quit: AJA4350]
ur5us has quit [Remote host closed the connection]
vutral1 has quit [Ping timeout: 244 seconds]
donofrio has quit [Ping timeout: 268 seconds]
hays has quit [Ping timeout: 268 seconds]
JoshS has joined #ruby
hays has joined #ruby
braincrash has quit [Quit: bye bye]
roshanavand has joined #ruby
braincrash has joined #ruby
hutch has quit [Ping timeout: 240 seconds]
elphe has quit [Ping timeout: 250 seconds]
elphe has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch has joined #ruby
RougeR has quit [Ping timeout: 244 seconds]
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
houhoulis has joined #ruby
cschneid has joined #ruby
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch has quit [Ping timeout: 272 seconds]
cschneid has quit [Remote host closed the connection]
darkhanb has joined #ruby
cruzo66342 has joined #ruby
cruzo66342 has quit [Remote host closed the connection]
d^sh has quit [Ping timeout: 272 seconds]
d^sh has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elphe has quit [Ping timeout: 250 seconds]
cruzo66342 has joined #ruby
cruzo66342 has quit [Remote host closed the connection]
ogres has quit [Quit: Connection closed for inactivity]
genpaku has quit [Ping timeout: 272 seconds]
genpaku has joined #ruby
cruzo66342 has joined #ruby
genpaku has quit [Remote host closed the connection]
kapil____ has quit [Quit: Connection closed for inactivity]
paranoicsan has joined #ruby
cruzo66342 has quit [Remote host closed the connection]
genpaku has joined #ruby
cruzo66342 has joined #ruby
cruzo66342 has quit [Ping timeout: 246 seconds]
rippa has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
elphe has joined #ruby
_whitelogger has joined #ruby
cthulchu_ has joined #ruby
cthu| has joined #ruby
masterasia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cthulchu_ has quit [Ping timeout: 246 seconds]
tdy has quit [Ping timeout: 245 seconds]
sarink has joined #ruby
hutch has joined #ruby
venmx has quit [Ping timeout: 240 seconds]
ua has quit [Ping timeout: 268 seconds]
houhoulis has quit []
elphe has quit [Ping timeout: 250 seconds]
ua has joined #ruby
elphe has joined #ruby
elphe has quit [Ping timeout: 250 seconds]
jshjsh has joined #ruby
JoshS has quit [Ping timeout: 240 seconds]
gix has joined #ruby
tiff has joined #ruby
hutch has quit [Ping timeout: 250 seconds]
Xiti has quit [Ping timeout: 250 seconds]
tiff has quit [Client Quit]
za1b1tsu has joined #ruby
tiff has joined #ruby
nowhere_man has quit [Read error: Connection reset by peer]
nowhere_man has joined #ruby
kapil____ has joined #ruby
clemens3_ has quit [Ping timeout: 240 seconds]
themsay has joined #ruby
themsay has quit [Read error: Connection reset by peer]
conta has quit [Remote host closed the connection]
<phaul>
(stick an other close paren before the .each)
conta has joined #ruby
<Swyper>
undefined local variable or method `length' for #<RSpec::ExampleGroups::SymmetricSubstrings:0x00007fbcb5a0e9b0>
<Swyper>
isent length supposed to be a built in method for string
nchambers has joined #ruby
<Swyper>
def symmetric_substrings(str) symm_subs = "" # initialize a blank string str.length.times do |start_pos| # .length is the length of string starting at 1,this loop is executing based on the amount of the string length
<Swyper>
the .length there is causing the error
<phaul>
length is indeed an instance method of strings.
<phaul>
but #<RSpec::ExampleGroups::SymmetricSubstrings:0x00007fbcb5a0e9b0> is not a string. We would need to see the rpsec files, to see what those are and why they are causing errors
<Swyper>
I've updated the gist with the RSpec files
<Swyper>
symmetric_substrings(str) is the method with the error
hutch has joined #ruby
elphe has joined #ruby
donofrio has joined #ruby
<Swyper>
phaul
<phaul>
yeah I'm looking.
<Swyper>
(2..(length - start_pos).each do |len| the problems here, length is not defined xD
<Swyper>
I think
<phaul>
yep. makes sense
elphe has quit [Ping timeout: 250 seconds]
TvL2386 has joined #ruby
donofrio has quit [Ping timeout: 246 seconds]
<Swyper>
what does << do in Ruby? google is not showing any results and typing what does greater then greater then do in ruby gives me nothing relevant :p
gix has joined #ruby
Guest49234 has joined #ruby
<phaul>
it's just an operator like many others. that means that for some type there is a method with the name << that defines some type specific behaviour
<phaul>
usually it appends an elem at the end of a collection
<phaul>
&ri Array.<<
<rubydoc>
Found no entry that matches class Array class method <<