jhass changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.5.3, 2.4.5, 2.3.8, 2.6.0-preview2: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
jcarl43 has quit [Quit: WeeChat 2.2]
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
knight33 has joined #ruby
knight33 has quit [Max SendQ exceeded]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
venmx has quit [Ping timeout: 268 seconds]
marmotini has joined #ruby
marmotini_ has quit [Ping timeout: 246 seconds]
RougeR has joined #ruby
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
dviola has joined #ruby
wojnar has joined #ruby
akaiiro has quit [Remote host closed the connection]
dviola has quit [Quit: WeeChat 2.2]
zwliew has joined #ruby
donofrio_ has quit [Remote host closed the connection]
donofrio_ has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
AJA4350 has quit [Quit: AJA4350]
Bacteria has quit [Quit: Lost terminal]
xfbs has quit [Quit: afk]
orbyt_ has joined #ruby
eckhardt has joined #ruby
patr0clus has joined #ruby
joast has quit [Quit: Leaving.]
akem has quit [Ping timeout: 252 seconds]
pskosinski has quit [Ping timeout: 268 seconds]
cagomez has joined #ruby
pskosinski has joined #ruby
joast has joined #ruby
Dimik has joined #ruby
lightstalker has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 272 seconds]
dviola has joined #ruby
dinfuehr has joined #ruby
lightstalker has joined #ruby
DTZUZO_ has quit [Ping timeout: 245 seconds]
cliluw has quit [Read error: Connection reset by peer]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cliluw has joined #ruby
Fusl has quit [Read error: Connection reset by peer]
wojnar has quit [Remote host closed the connection]
Fusl has joined #ruby
arescorpio has joined #ruby
apparition has joined #ruby
<JasonO> hello, I am trying to seed some data using rake. however, I receive the following error:
<JasonO> rake aborted!
<JasonO> NameError: uninitialized constant DeliveryPerson
<JasonO> db/seeds.rb:2:in `<top (required)>'
<JasonO> my models are accurate as well. any help would be appreciated
patr0clus has quit [Ping timeout: 244 seconds]
fluxAeon has joined #ruby
BTRE has quit [Remote host closed the connection]
patr0clus has joined #ruby
patr0clus is now known as s3nd1v0g1us
<JasonO> anyone here?
<JasonO> I am trying to seed some data using rake. however, I receive the following error:
<JasonO> db/seeds.rb:2:in `<top (required)>'
<JasonO> my models are accurate as well. any help would be appreciated
BTRE has joined #ruby
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
dviola has quit [Quit: WeeChat 2.2]
s3nd1v0g1us has quit [Ping timeout: 252 seconds]
s3nd1v0g1us has joined #ruby
apparition has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
noobineer has joined #ruby
def_jam has joined #ruby
eb0t_ has joined #ruby
braincrash has quit [Quit: bye bye]
s3nd1v0g1us has quit [Remote host closed the connection]
za1b1tsu has joined #ruby
eblip has quit [Ping timeout: 250 seconds]
eb0t has quit [Ping timeout: 246 seconds]
braincrash has joined #ruby
apparition has joined #ruby
zwliew has quit [Quit: Connection closed for inactivity]
nadir has joined #ruby
hahuang6- has joined #ruby
hahuang65 has quit [Ping timeout: 276 seconds]
MoritaShinobu has joined #ruby
KeyJoo has joined #ruby
<JasonO> figured it out
Dimik has quit [Ping timeout: 244 seconds]
qolq has quit [Read error: Connection reset by peer]
qolq has joined #ruby
mangold has joined #ruby
KeyJoo has quit [Read error: Connection reset by peer]
eckhardt has joined #ruby
orbyt_ has joined #ruby
za1b1tsu has quit [Quit: WeeChat 2.1]
mangold has quit [Quit: This computer has gone to sleep]
xuanrui has joined #ruby
johnny56 has quit [Ping timeout: 272 seconds]
cagomez has quit [Remote host closed the connection]
kurko_ has joined #ruby
cagomez has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
tdy has quit [Ping timeout: 245 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has quit [Remote host closed the connection]
za1b1tsu has joined #ruby
_whitelogger has joined #ruby
johnny56 has joined #ruby
arescorpio has quit [Quit: Leaving.]
gnufied has quit [Ping timeout: 246 seconds]
xuanrui has quit [Remote host closed the connection]
ua has quit [Ping timeout: 252 seconds]
cliluw has quit [Read error: Connection reset by peer]
petemoore has quit [Ping timeout: 276 seconds]
vdl has quit [Ping timeout: 272 seconds]
RougeR has quit [Ping timeout: 272 seconds]
reber has joined #ruby
petemoore has joined #ruby
leonthemisfit has quit [Ping timeout: 272 seconds]
leonthemisfit has joined #ruby
vdl has joined #ruby
segy has quit [Quit: ZNC - http://znc.in]
segy has joined #ruby
eckhardt_ has joined #ruby
jetchisel has joined #ruby
rippa has joined #ruby
kapil____ has joined #ruby
venmx has joined #ruby
mangold has joined #ruby
dellavg_ has joined #ruby
endemic has quit [Ping timeout: 264 seconds]
noobineer has quit [Ping timeout: 252 seconds]
doubledup has joined #ruby
eckhardt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
segy has quit [Read error: Connection reset by peer]
petemoore has quit [Ping timeout: 250 seconds]
petemoore has joined #ruby
segy has joined #ruby
whysthatso has quit [Quit: whysthatso]
eckhardt_ has joined #ruby
LiftLeft has quit [Ping timeout: 260 seconds]
eckhardt_ has quit [Client Quit]
apparition has quit [Quit: Bye]
eckhardt_ has joined #ruby
LiftLeft has joined #ruby
eckhardt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
marmotini has quit [Ping timeout: 244 seconds]
apparition has joined #ruby
venmx has quit [Ping timeout: 272 seconds]
rwb has quit [Ping timeout: 252 seconds]
tdy has joined #ruby
whysthatso has joined #ruby
chorler has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
petemoore has quit [Ping timeout: 252 seconds]
mangold has quit [Quit: This computer has gone to sleep]
petemoore has joined #ruby
xuanrui has joined #ruby
za1b1tsu has quit [Ping timeout: 252 seconds]
GodFather has quit [Read error: Connection reset by peer]
sameerynho has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
GodFather has joined #ruby
doubledup has quit [Quit: Leaving]
phaul has joined #ruby
doubledup has joined #ruby
doubledup has quit [Remote host closed the connection]
venmx has joined #ruby
ellcs has joined #ruby
ellcs has quit [Ping timeout: 252 seconds]
chorler has left #ruby ["Konversation terminated!"]
apeiros_ has quit [Remote host closed the connection]
mikecmpbll has quit [Quit: inabit. zz.]
discopatrick has quit [Quit: Connection closed for inactivity]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
jetchisel has quit [Ping timeout: 246 seconds]
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
Nicmavr has quit [Read error: Connection reset by peer]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
Nicmavr has joined #ruby
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
wojnar has joined #ruby
snickers has joined #ruby
RougeR has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
rubydoc has quit [Remote host closed the connection]
Fusl has quit [Ping timeout: 256 seconds]
rubydoc has joined #ruby
<phaul> &ri http_default_port
<phaul> Now everything is linked from core & stdlib.
<phaul> also everything is searchable
<phaul> &list %HTTP::%
<rubydoc> Net::HTTP::Copy (net/http), Net::HTTP::Delete (net/http), Net::HTTP::Get (net/http), Net::HTTP::Head (net/http), Net::HTTP::Lock (net/http), Net::HTTP::Mkcol...
konsolebox has joined #ruby
lxsameer has joined #ruby
za1b1tsu has joined #ruby
venmx has quit [Ping timeout: 272 seconds]
lxsameer has quit [Ping timeout: 268 seconds]
za1b1tsu has quit [Ping timeout: 252 seconds]
mikecmpbll has joined #ruby
mangold has joined #ruby
konsolebox has quit [Read error: Connection reset by peer]
Fusl has joined #ruby
venmx has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
za1b1tsu has joined #ruby
ur5us has joined #ruby
ur5us has quit [Ping timeout: 244 seconds]
mangold has quit [Quit: This computer has gone to sleep]
mikecmpbll has quit [Quit: inabit. zz.]
apeiros_ has joined #ruby
jetchisel has joined #ruby
def_jam is now known as eblip
desperek has joined #ruby
jetchisel has quit [Ping timeout: 250 seconds]
themsay has joined #ruby
nowhere_man has quit [Ping timeout: 252 seconds]
<JasonO> hello, I am creating am method to assign a random number to a value when iterating. however, I want to break out of the loop then resume to ensure all elements have different values. how can i do this?
<JasonO> *a
<JasonO> break didn't help
Hobbyboy has quit [Quit: I think the BNC broke.]
apeiros_ has joined #ruby
armyriad has joined #ruby
Eiam has quit [Read error: Connection reset by peer]
Hobbyboy has joined #ruby
evdubs_ has joined #ruby
<apeiros_> JasonO: paraphrasing: you want to generate an array with N distinct random numbers?
apeiros_ has quit [Read error: Connection reset by peer]
evdubs_ has quit [Remote host closed the connection]
armyriad has quit [Read error: Connection reset by peer]
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
snk has quit [Ping timeout: 260 seconds]
<phaul> n.times.entries.shuffle
snk has joined #ruby
<apeiros_> `n.times.entries` can be shortened to `[*0...n]`
<apeiros_> and it assumes the pool of numbers is 0...N, but it might be unrelated to the size of the resulting array.
<apeiros_> (i.e. an array of 20 elements with random values 100..200)
mangold has joined #ruby
<JasonO> apeiros_ phaul something like this https://repl.it/repls/YouthfulGreenyellowCharactermapping nothing with arrays. I want to assign random ids to each user while iterating. but if I iterate at once all users will get the same random number. I need a way to break and continue so this does not happen
<apeiros_> eh, gotta go. boarding starts. cya :)
apeiros_ has quit []
<JasonO> :(
xfbs has joined #ruby
<phaul> so why don't you move random_post_office = ... into the loop.
<phaul> There is an other issue: I think you are iterating counter * counter times
<phaul> why do you need the double nested loops?
<JasonO> I removed some things. this is what I am working on now per your suggestion phaul https://repl.it/repls/YouthfulGreenyellowCharactermapping
nadir has joined #ruby
<phaul> don't put your local variables into the class scope. It's legal and valid, but it doesn't do what you think it does.
<phaul> The local var name inside the class does not propagate into the methods defined with def
kapil____ has joined #ruby
<JasonO> okay I'll move them
<JasonO> hmm..
<JasonO> no update
<phaul> post what you have so far
<JasonO> oops, forgot index
<JasonO> ok
<JasonO> nice. it worked!
<JasonO> just needed the index
<JasonO> thanks phaul \
<phaul> &ri Array#rand
<rubydoc> Found no entry that matches class Array instance method rand
<JasonO> *thanks phaul
<JasonO> ?
<phaul> &ri Array.sample
<rubydoc> Found no entry that matches class Array class method sample
<phaul> &ri Array#sample
<JasonO> aah. okay I'll use sample so no need for ikndex
<phaul> finally :)
<JasonO> *index
<JasonO> haha
<phaul> sad thing is that its my own bot :D
<JasonO> XD
Tempesta has quit [Ping timeout: 268 seconds]
tbuehlmann has quit [Ping timeout: 252 seconds]
tbuehlmann has joined #ruby
AJA4350 has joined #ruby
Inline has quit [Quit: Leaving]
Inline has joined #ruby
nowhere_man has joined #ruby
Puffball has quit [Remote host closed the connection]
Puffball has joined #ruby
Luffy has quit [Quit: ZNC - http://znc.in]
za1b1tsu has quit [Ping timeout: 246 seconds]
nowhere_man has quit [Ping timeout: 252 seconds]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
za1b1tsu has joined #ruby
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
themsay has quit [Ping timeout: 268 seconds]
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
mangold has quit [Quit: This computer has gone to sleep]
marmotini_ has joined #ruby
ule has quit [Quit: WeeChat 1.9.1]
mikecmpbll has joined #ruby
Dbugger has joined #ruby
jetchisel has joined #ruby
marmotini_ has quit [Ping timeout: 252 seconds]
Dimik has joined #ruby
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
DTZUZO has joined #ruby
wojnar has quit [Remote host closed the connection]
jetchisel has joined #ruby
ta_ has joined #ruby
Dbugger has quit [Ping timeout: 276 seconds]
discopatrick has joined #ruby
oleo2 has joined #ruby
oleo2 has quit [Ping timeout: 260 seconds]
oleo2 has joined #ruby
apparition has quit [Quit: Bye]
marmotini_ has joined #ruby
desperek has quit [Read error: Connection reset by peer]
phaul has quit [Quit: bye]
phaul has joined #ruby
venmx has quit [Ping timeout: 246 seconds]
marmotini_ has quit [Ping timeout: 252 seconds]
ule has joined #ruby
marmotini_ has joined #ruby
xfbs has quit [Quit: afk]
kapil____ has quit [Quit: Connection closed for inactivity]
fluxAeon has quit [Ping timeout: 246 seconds]
houhoulis has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.2]
al2o3-cr has joined #ruby
marmotini_ has quit [Ping timeout: 252 seconds]
sticaz has joined #ruby
marmotini_ has joined #ruby
rivalomega has joined #ruby
Yxhuvud has quit [Remote host closed the connection]
dcope has joined #ruby
Yxhuvud has joined #ruby
RougeR has quit [Ping timeout: 245 seconds]
dcope has left #ruby [#ruby]
Dbugger has joined #ruby
venmx has joined #ruby
MoritaShinobu has quit [Remote host closed the connection]
akaiiro has joined #ruby
armyriad has quit [Quit: Leaving]
Yxhuvud has quit [Remote host closed the connection]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
Yxhuvud has joined #ruby
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
MoritaShinobu has joined #ruby
kurko_ has joined #ruby
kurko_ has quit [Client Quit]
uplime has quit [Ping timeout: 252 seconds]
orbyt_ has joined #ruby
MoritaShinobu has quit [Quit: Leaving]
za1b1tsu has quit [Ping timeout: 246 seconds]
akaiiro has quit [Remote host closed the connection]
akaiiro has joined #ruby
whysthatso_ has joined #ruby
whysthatso has quit [Ping timeout: 260 seconds]
whysthatso_ is now known as whysthatso
whysthatso has quit [Quit: whysthatso]
whysthatso has joined #ruby
bdnelson has joined #ruby
bdnelson has quit [Client Quit]
rkoller has joined #ruby
akaiiro has quit [Ping timeout: 252 seconds]
phaul has quit [Quit: bye]
phaul has joined #ruby
DTZUZO has quit [Ping timeout: 245 seconds]
armyriad has joined #ruby
uplime has joined #ruby
marmotini has joined #ruby
marmotini_ has quit [Ping timeout: 268 seconds]
nadir has quit [Quit: Connection closed for inactivity]
snickers has joined #ruby
rivalomega has quit [Read error: Connection reset by peer]
rivalomega has joined #ruby
marmotini has quit [Ping timeout: 260 seconds]
tdy has quit [Ping timeout: 252 seconds]
jackrandom has quit [Quit: ZNC - https://znc.in]
jackrandom has joined #ruby
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #ruby
rivalomega has quit [Read error: Connection reset by peer]
rivalomega has joined #ruby
GodFather has quit [Ping timeout: 272 seconds]
GodFather has joined #ruby
marmotini has joined #ruby
Dbugger has quit [Remote host closed the connection]
jasmith has quit [Ping timeout: 244 seconds]
im0nde has quit [Ping timeout: 252 seconds]
Dbugger has joined #ruby
oleo2 has quit [Ping timeout: 252 seconds]
RougeR has joined #ruby
marmotini has quit [Ping timeout: 252 seconds]
patr0clus has joined #ruby
im0nde has joined #ruby
patr0clus is now known as s3nd1vog1us
s3nd1vog1us is now known as s3nd1v0g1us
discopatrick has quit [Quit: Connection closed for inactivity]
troulouliou_dev has joined #ruby
oleo2 has joined #ruby
oleo2 has quit [Ping timeout: 260 seconds]
djellemah has quit [Remote host closed the connection]
rkoller has quit [Quit: Textual IRC Client: www.textualapp.com]
Fusl has quit [Ping timeout: 256 seconds]
jiffe has joined #ruby
m27frogy has quit [Quit: ZNC - https://znc.in]
Fusl has joined #ruby
nowhere_man has joined #ruby
RougeR has quit [Ping timeout: 244 seconds]
ua has joined #ruby
RougeR has joined #ruby
weaksauce has joined #ruby
cd has quit [Quit: cd]
cd has joined #ruby
tdy has joined #ruby
dinfuehr_ has joined #ruby
dinfuehr has quit [Ping timeout: 268 seconds]
apeiros_ has joined #ruby
Dbugger has quit [Ping timeout: 264 seconds]
<jiffe> so I am trying to get a ruby application [https://github.com/Mpompili/vibesky] going. I'm not familiar with ruby atm, but I was able to run through the setup which installed dependencies and created the necessary database. Running rails server I am able to get what looks like the api going, but I'm not sure how to get the frontend going which looks like it also runs through ruby
nowhere_man has quit [Ping timeout: 264 seconds]
<jiffe> I can find the associated html, but I'm not sure what needs to be done to expose it, I don't know if anyone sees anything obvious that I'm missing
c-c has joined #ruby
<c-c> I have a mind-effing case-when problem, involving a string split into an array + call to a function from one when block.
<c-c> - For some reason I can p the arr[1] inside the when, but passing it as an argument to another method from inside the when statement causes an error --> proggy dies
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> c-c: easiest way to describe it is to show us code
<c-c> awwww
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<phaul> topic these days suggests dpaste.de but gist.github is also fine. Channel bot will tell you off for pastebin. But honestly, whatever you are more familiar with
<c-c> - when making the paste, I noticed the method was declared outside the class
<c-c> 8)
bak1an has joined #ruby
<c-c> I usually use gist. Anyway, so found the problem: code blindness. Thank you
<c-c> 8)
s3nd1v0g1us has quit [Ping timeout: 252 seconds]
dellavg_ has quit [Ping timeout: 246 seconds]
s3nd1v0g1us has joined #ruby
uplime is now known as Frankenstein
<jiffe> so I created a new rail, its listening on port 3000 and I see 'Yay! You’re on Rails!', trying to grep for that title in the created directory I don't see it anywhere, where does that come from?
icarus has joined #ruby
houhoulis has quit [Remote host closed the connection]
<jiffe> ah nm found it in a global template directory
<icarus> hello all, I have an endpoint that needs a post request (IE, curl --data '{"example":"data"}'), is anyone familiar with out to do this with httparty?
<icarus> with curl, this looks like: curl --data '{"example":"data"}' $url
<icarus> same for httparty via cli: httparty --data '{"example":"data"}' $url
ur5us has joined #ruby
sticaz has quit [Quit: sticaz]
<icarus> ah screw it, im just going to hard code `httparty --data '{"example":"data"}' $url`, yolo
ur5us has quit [Ping timeout: 264 seconds]
<c-c> so "return if in_str == nil" errors, but "return if in_str==nil" doesn't?
<c-c> but "p in_str == nil" does not error?
whysthatso has quit [Quit: whysthatso]
<baweaver> c-c: what's the error?
<c-c> well the thing is I have the code running in a separate proc so I can't see the error (and thats why I'm confused)
<c-c> - All I see is the prog dying (it kills all procs if one fails)
<c-c> And, please note that my question 6 minutes before isn't correct, error was caused by something else
fredlinhares has joined #ruby
<phaul> "return if in_str == nil" is equivalent to "return if in_str==nil", https://gist.github.com/a02a1fd8a89858ea54c3426ecc1f5a68
<c-c> kewl, is that the tokenizer?
<phaul> parser
<c-c> onk parser
<phaul> you have access to the instruction sequence too :) https://www.nasseri.io/posts/1.html
cagomez has joined #ruby
<c-c> I have this endless nil testing when handling input from pipes https://gist.github.com/csmr/c114ae746f5ba531830ae553fe184544
<c-c> -even the read_line_nonblocking has to check for nil twice
<c-c> Any ideas how to avoid that in read_pipes (the method in the gist)
<phaul> well...maybe monad springs to mind :)
<phaul> there is &. inruby
<c-c> monads in ruby?
cagomez has quit [Remote host closed the connection]
<phaul> I seen implementations.. but &. would be my first try
orbyt_ has joined #ruby
<c-c> hm, I don't remember seeing "&.", how to use it?
<c-c> oh, its an operator
<baweaver> easy there
<baweaver> monads are overkill.
<c-c> hm, I think monads won't happen in my little game enginde
<phaul> we 3 are all agree
troulouliou_dev has quit [Quit: Leaving]
<baweaver> That's most of the reason I made Qo was to pipe input conditionally without breaking out of a flow
<phaul> rly? Can you show us a snippet?
<phaul> I never imagined Qo can do that
kurko_ has joined #ruby
<baweaver> One sec, let me adapt to their code.
<c-c> So what I always get from read_line is nil, or a string key-value (separated by " "). So unless its a nil, it should be string, split by " ", and then case applied to [0].
dviola has joined #ruby
<phaul> read_line&.split(' ')
<baweaver> It's a bit silly with the debug pipe on it, but general idea is I use it to control dispatch much like a case statement
<baweaver> except with some more fine grained controls. It's be more useful if there were partial message matches or other factors.
<c-c> baweaver: whats 'Qo'?
<baweaver> Pattern matching and fluent querying in Ruby
<baweaver> people.select(&Qo[name: /^B/, age: 10..])
<phaul> baweaver: is the double m.when(Qo.not(nil)) intentional in the first block?
<baweaver> I suppose it's redundant
<phaul> I don't know :) I don't understand you code :)
<baweaver> Ah good
<baweaver> that makes two of us
icarus has quit [Read error: Connection reset by peer]
icarus has joined #ruby
nadir has joined #ruby
<c-c> I guess what I want to do is: if (msg=read_something_that_hopefully_isnt_nil).split(" ") { # do stuff with known non-nil array }
<c-c> Is that ugly? 8)
<c-c> suggest alternative syntax for this?
<phaul> read_something&.split(' ')&.yield_self { |obj| obj ... }
<phaul> it might be rough around the edges.. let me try if it works :)
s3nd1v0g1us has quit [Ping timeout: 252 seconds]
<phaul> this worked 'alma korte'&.split(' ')&.yield_self { |alma, korte| p alma: alma, korte: korte }
<phaul> with nil it's just nil
<phaul> the former works too..
<phaul> but obj is the array of the pair..
themsay has joined #ruby
<c-c> >> def read_sim(arg=nil); return arg; end; read_sim("CMDstr FOOBAR")&.split(' ')&.yield_self {|o| p o} && read_sim()&.split(' ')&.yield_self {|o| p o }
<ruby[bot]> c-c: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
reber has quit [Remote host closed the connection]
<phaul> the site the bot is using is broken
<c-c> weird, my irb responds undefined method 'yield_self'
<phaul> ah. you are on old ruby
<baweaver> 2.5 intro'd it didn't it?
<c-c> ok, I'm on 2.3.3p222
<c-c> so much peeve
<c-c> - I have to test to for nil!
themsay has quit [Ping timeout: 244 seconds]
<phaul> you can suffix condition on the unhappy path... msg = read; return if msg.nil?; .... that way it's just 1 line and no end
<c-c> yeah have stuff like msg = rwe[0][0].gets.strip unless rwe == nil || rwe[0][0] == nil
<c-c> - which will fail if that returns nil
<c-c> 8P
<phaul> actually updated the gist . with &.tap it looks almost... good :)
<phaul> but I broke the funtion return value :( if you care about that
<phaul> I assume @msg_stack.push wasn't returning anything useful anyway
<phaul> surely not it was in an if with no else case...
apeiros_ has quit []
<c-c> So, this works: msg = rwe[0][0] unless rwe == nil || rwe[0][0] == nil -- but rwe[0][0].gets.strip doesn't!
<c-c> its as if it ecals the strip before the unless
<c-c> *evals
<phaul> c-c: have you seen my fork of your gist?
<phaul> what do you think?
<c-c> was struggling ther for 10 minutes with new syntax bugs
<c-c> aw, my ruby doesn't support &.
<phaul> ah.
<phaul> that's a bummer :)
<c-c> ah well, I'll have to accept that
<phaul> my best is the revision before that then. still it shaves off a few lines
<c-c> let me revisit this nil syntax pet peeve with a more illustrative gist https://gist.github.com/csmr/177daf69dfaffed11306f9a5b6fa0cbf
mangold has joined #ruby
<c-c> Its like I have set nil or test for nil on every 2nd line all the time
<lupine> so don't?
dviola has quit [Quit: WeeChat 2.2]
<phaul> c-c: at least msg = nil lines are redundant
<phaul> I also posted a revision that should work on 2.3 before the &.tap revision..
blackmesa has joined #ruby
<c-c> interestingly &.split seems to work.. I think
dviola has joined #ruby
venmx has quit [Ping timeout: 260 seconds]
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mikecmpbll has quit [Quit: inabit. zz.]
<phaul> c-c: if &.split works then every method works with &. even tap. What was the issue you had exactly?
<c-c> having to constantly ensure the wahtever is not nil
<phaul> no I mean with the code I posted on my gist
<phaul> you said you had syntax issues
<lupine> so don't return nil
<c-c> I still do
<phaul> can you post them?
<c-c> In fact this whole thing is "fragile" when I wanted it to just sit and run even if nothing is read
<lupine> aww, `undef nil` doesn't work :D
<phaul> :)
rivalomega has quit [Remote host closed the connection]
rivalomega has joined #ruby
jetchisel has quit [Ping timeout: 272 seconds]
fredlinhares has quit [Ping timeout: 240 seconds]
icarus has quit [Ping timeout: 252 seconds]
rivalomega has quit [Ping timeout: 264 seconds]
leah2 has quit [Ping timeout: 244 seconds]
mikecmpbll has joined #ruby
pharma_joe has joined #ruby
pharma_joe has quit [Client Quit]
hightower2 has quit [Ping timeout: 252 seconds]
raulp has joined #ruby
leah2 has joined #ruby
* phaul sigh
fredlinhares has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<c-c> Ok finally managed to fix the regression
<c-c> I feel as if there maybe is whole another approach, but I keep ending in imperative land where I test if nil after/before IO: https://gist.github.com/csmr/177daf69dfaffed11306f9a5b6fa0cbf
<c-c> this seems bit exessive, given the input is always of format "VERB NOUN"
<c-c> - And I'm still not sure if read_line_nonblocking might return something funny when msg == nil
<phaul> as you seem to be completely ignoring my comments on this I am out..
<c-c> phaul thanks for input. I'm sorry but your comment on removing nils didnt seem to work, as "&."
<phaul> │235413 phaul | c-c: at least msg = nil lines are redundant
<c-c> yup, thats incorrect
Frankenstein has quit [Ping timeout: 250 seconds]
<phaul> 000550 phaul | c-c: if &.split works then every method works with &. even tap. What was the issue you had │ bga57
<phaul> │ | exactly? y
<c-c> yeah, haven't managed to remove single nil yet
cd has quit [Quit: cd]
<c-c> I think this whole boat needs to be turned around
<phaul> I'm well aware. I posted something. You said it didn't work because &. Then you said &. works. Then I asked what was the error then
<c-c> well, stuff breaks if not watching out for nil explicitly in every turn
sameerynho has quit [Ping timeout: 272 seconds]
<phaul> my code was supposed to be functionally equivalent to yours. with all the ifs.
mroutis has joined #ruby
<phaul> I did not just post something where I just removed checks
<phaul> I can make an other attempt at rewriting your code. the newest gist. If you say it works at its current form.
<c-c> I think this whole thing is somehow wrong
<phaul> well. Null pattern. Maybe monad. &. . these are the tools. https://www.youtube.com/watch?v=J1jYlPtkrqQ
<c-c> The basic concept is a process reading input stream, store lines in msg_stack - unless none, then read the msg_stack to see what to do with state
<phaul> it's a relly great video, and he solves this exact problem.