SeepingN has quit [Quit: The system is going down for reboot NOW!]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gell5 has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jetchisel has joined #ruby
gell5 has quit [Ping timeout: 260 seconds]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
nychtel has joined #ruby
poro has joined #ruby
goepsilongo has joined #ruby
poro has quit [Quit: Leaving]
lightstalker has quit [Ping timeout: 260 seconds]
quazimodo has joined #ruby
lightstalker has joined #ruby
dualfade has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
chris____ has joined #ruby
Comstock has joined #ruby
ur5us has joined #ruby
ChmEarl has quit [Quit: Leaving]
plutes has quit [Ping timeout: 272 seconds]
jetchisel has quit [Ping timeout: 264 seconds]
gix has quit [Ping timeout: 246 seconds]
<dualfade>
anyone using vim as a ruby ide ?
<apotheon>
I use Vim.
<apotheon>
. . . along with irb+interactive_ruby.
<apotheon>
It's kind of an inside-out IDE that way.
<dualfade>
huh I see. have you ever tried spacevim or anythng like that by chance ?
<apotheon>
nope
<dualfade>
ive been using it for quit sometime in python but autocompletion and friends are not working with ruby. Kinda odd.
<dualfade>
was looking for alternatives I guess.
<apotheon>
I tend to keep my Vim setup pretty simple.
<dualfade>
gotcha. much apprecoates. thank you for replying. New to ruby... JUst starting with it.
nicholaslyang has joined #ruby
<apotheon>
My .vimrc is almost a hundred lines long, but if you cut out comments, blank lines, and "autocmd BufEnter" stuff, it's about a third that many.
<apotheon>
(where the BufEnter stuff is all crap like language-specific indentation and syntax highlighting management)
<apotheon>
I very much like both vi stuff and Ruby.
cfjk has joined #ruby
<apotheon>
I use vi keybindings in irb, too.
<dualfade>
nice. Im hoping I like it and all goes well. Python is pissing me off to no extent hahah
<apotheon>
har
<apotheon>
I'm not a big fan of Python.
<dualfade>
the modules are something to be told hah
<dualfade>
I just bought a bunch of book and gonna try to start the migration. hoping for goodness. hah
<dualfade>
is there a site you recommend for getting started ? like if you know perl pretty well and decent with python ?
<apotheon>
hrm
<apotheon>
I don't, really.
<dualfade>
I come from perl land ( 20 years ) dont laugh haha
<dualfade>
ok.
<apotheon>
If you want to learn Rails, guides.rubyonrails.org might get you up and running quickly. For Ruby itself, I just have recommendations for books.
<apotheon>
I used to really be into Perl, until about fifteen years ago. I suspect a tutorial or two that I wrote are still in the semi-official lineup of tutorials on PerlMonks.
<dualfade>
killer. used that site many many times.
chris____ has quit [Remote host closed the connection]
<dualfade>
Well much appreciated. Im gonna try to get this thing started somewhat for tonight. Thanks again
<apotheon>
For books, I think a great starting Ruby book-path is something like Eloquent Ruby -> POODR -> Sinatra Up And Running -> Understanding Computation (the second, third, and fourth can be moved around in order according to your preferences).
<apotheon>
For Rails, you could skip Sinatra Up And Running and cram the Rails Guides in there early on, probably right after Eloquent Ruby.
<apotheon>
There are other great books, too. Ruby is blessed with a glut of excellent books.
sauvin has quit [Read error: Connection reset by peer]
cliluw has quit [Ping timeout: 256 seconds]
cliluw has joined #ruby
fercell has joined #ruby
sauvin has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
conta has joined #ruby
ur5us has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cgfbee has quit [Remote host closed the connection]
gell5 has joined #ruby
imode has quit [Ping timeout: 260 seconds]
gell5 has quit [Ping timeout: 246 seconds]
cgfbee has joined #ruby
xco has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sarna has joined #ruby
<sarna>
hey, I want to be able to create my class in two ways - either directly from parameters, or by parsing some json. how would I go about implementing this? I've been thinking factories, but they seem.. clunky
plutes has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
<jhass>
mh, usually something like the parsing from json way would invoke the first way, right?
<jhass>
so make that your primary constructor, then just do def self.from_json(json); data = JSON.parse(json); new(...); end
nicholaslyang has joined #ruby
<sarna>
oh yeah, that seems right
<sarna>
thanks :)
<jhass>
yw :)
<sarna>
also - should the class be responsible for parsing, or should it get parsed json? in your example it does the parsing, is that conventional?
<AndreYuhai>
yxhuvud, Oh yea map already does what I meant haha. Thank you. :)
<AndreYuhai>
I just thought I could do that with an each loop but I am probably wrong
nicholaslyang has joined #ruby
conta has quit [Quit: conta]
doomlist3 has quit [Ping timeout: 264 seconds]
nicholaslyang has quit [Client Quit]
<yxhuvud>
Well, each returns an iterator and iterators also respond to map, so [1,2,3].each.map { |x| x + 1 } would also work
doomlist3 has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Ping timeout: 264 seconds]
<AndreYuhai>
yxhuvud, thank you
nicholaslyang has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
nicholaslyang has quit [Client Quit]
jingjinghack has joined #ruby
lazarus1 has joined #ruby
postmodern has quit [Quit: Leaving]
<sarna>
I'm trying to use Faraday and it doesn't seem to respect the params I give it.. can I somehow inspect the request before executing it?
<sarna>
an url would be enough I think
<sarna>
oh, #get takes a block
<sarna>
well.. my params got nested >.>
<sarna>
I create a connection with params and then add params when executing connection#get.. I end up with `params: {foo: "bar", params: {baz: "qux"}}`
<sarna>
how would I solve this? I'm really confused :/
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
<sarna>
I solved it with this: `conn.get 'path' do |request| request.params['foo'] = 'bar' end`
<jennis>
I've tried Devise.email_regexp , /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i (from Michael Hartl's rails tutorial), the builtin Ruby URI:MailTo:EMAIL_REGEXP and the Mail gem's Mail::Address.new('foo.@bar.com') , all of them say that this is a valid email!
Secret-Fire has quit [Read error: Connection reset by peer]
<jhass>
(it really doesn't make a difference for what we talked about)
drincruz has joined #ruby
<apotheon>
ta: This is going to make my standard farewell more difficult.
<apotheon>
ta: I didn't even know there was someone with that name here.
mikecmpbll has joined #ruby
TakumoK is now known as Takumo
jingjinghack has quit [Quit: WeeChat 2.1]
<ta>
apotheon: ;)
iNs has quit [Remote host closed the connection]
<apotheon>
I say goodbye / And you say hello
<apotheon>
(to paraphrase the song)
iNs has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
doomlist3 has quit [Ping timeout: 260 seconds]
Lazarus2 has joined #ruby
bvdw has quit [Remote host closed the connection]
lazarus1 has quit [Ping timeout: 260 seconds]
TCZ has joined #ruby
bvdw has joined #ruby
doomlist3 has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
bvdw has quit [Remote host closed the connection]
<AndreYuhai>
Why do I get undefined method 'update' for nil:NilClass error here: https://dpaste.org/3DJ9 ? If I define a method directly inside of the User class instead of including the module then it works.
bvdw has joined #ruby
<AndreYuhai>
I mean I just did this: https://dpaste.org/4PRh inside the User class and I had no errors.
<adam12>
AndreYuhai: So the exception would point to line 21 in your paste?
<AndreYuhai>
adam12, yes, sorry I forgot to mention that
<adam12>
AndreYuhai: Np. I kinda figured but it helps to know exact line numbers.
<adam12>
AndreYuhai: Out of curiosity, can you change entry_count = to be self.entry_count =
<adam12>
AndreYuhai: It's hard to follow without a stacktrace but you're doing an assignment inside the ternary but it looks unused. Maybe it's eventually going to be used?
<AndreYuhai>
adam12, Yes, I just tried it once and it worked but let me make sure.
<AndreYuhai>
adam12, that assignment is actually for the entry_count of the User like self.entry_count = EntryCount.new ...
stryek has joined #ruby
gell5 has joined #ruby
kiwi_83 has joined #ruby
<adam12>
AndreYuhai: So you definitely need self there then, because without it, Ruby thinks you're assigning a local variable. self.entry_count= is a method call.
<AndreYuhai>
adam12, but then if the ternary evaluates to false, shouldn't the false part just execute without any problem?
<adam12>
AndreYuhai: Yes. But somehow you're getting nil there. It's hard to know without a stack trace.
kiwi_83 has quit [Quit: Connection closed]
gell5 has quit [Ping timeout: 256 seconds]
ellcs1 has joined #ruby
<AndreYuhai>
adam12, when I put self, everything works fine. Thank you :)
sarna has quit [Quit: Connection closed]
alexherbo2 has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
SeepingN has joined #ruby
ChmEarl has joined #ruby
dionysus69 has joined #ruby
conta has quit [Quit: conta]
TCZ is now known as DOMSlayer2020
banisterfiend has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
rippa has joined #ruby
nychtel has joined #ruby
DOMSlayer2020 is now known as TCZ
orbyt_ has joined #ruby
gato has joined #ruby
Lazarus2 has quit [Quit: Leaving]
nicholaslyang has joined #ruby
buckworst has quit [Quit: WeeChat 2.8]
nicholaslyang has quit [Client Quit]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
chris____ has joined #ruby
alexherbo29 has joined #ruby
alexherbo2 has quit [Ping timeout: 264 seconds]
alexherbo29 is now known as alexherbo2
lucasb has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Nielson has quit [Remote host closed the connection]
kgrz has quit [Client Quit]
gell5 has joined #ruby
gell5 has quit [Ping timeout: 258 seconds]
buckworst has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
wald0 has joined #ruby
chris____ has quit [Ping timeout: 256 seconds]
nicholaslyang has joined #ruby
buckworst has quit [Quit: WeeChat 2.8]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nicholaslyang has joined #ruby
cd has joined #ruby
xco has joined #ruby
pwnd_nsfw` has joined #ruby
duderonomy has joined #ruby
pwnd_nsfw has quit [Ping timeout: 264 seconds]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kloeri has quit [Remote host closed the connection]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
kloeri has joined #ruby
cliluw has joined #ruby
ur5us has joined #ruby
cliluw has quit [Ping timeout: 256 seconds]
cliluw has joined #ruby
howdoi has joined #ruby
mikecmpbll has quit [Ping timeout: 260 seconds]
mikecmpbll has joined #ruby
alexherbo2 has quit [Ping timeout: 246 seconds]
chamunks- has quit [Quit: Don't worry I'm not gone yet.]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
ur5us has quit [Ping timeout: 256 seconds]
sauvin has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
kristian_on_linu has joined #ruby
gell5 has joined #ruby
chamunks has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
vondruch has quit [Ping timeout: 264 seconds]
<doomlist3>
if (i<4) then ... vs if i<4 ... what's the difference , while ... do vs while and for ... do vs for ...
nicholaslyang has joined #ruby
gell5_ has joined #ruby
gell5 has quit [Ping timeout: 246 seconds]
leitz has joined #ruby
roadie has quit [Ping timeout: 272 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
<adam12>
doomlist3: then is optional for if. When used with case when it allows same-line conditional and logic (ie. when foo then do_bar)
<adam12>
doomlist3: do/end is a block construct. It's sometimes also { and } but not always, since {} can be used to construct a Hash.
<doomlist3>
while ... do ... is it equivalent to while ...
wald0 has quit [Quit: Lost terminal]
<adam12>
doomlist3: In the case of while, the `do` piece is optional. This is the same for `for` since they are both keywords.
ncakerlist has joined #ruby
<ncakerlist>
is there a link that explains this while do end vs while end
<adam12>
doomlist3: while is normally used for a conditional, less so for a loop. for is usually frowned upon for loops since Ruby has an Enumerable module with lots of nice things in it (upto, step, times, etc)
<ncakerlist>
how can while be a conditional like if, when it's a loop ... and if used for conditional why not just if elsif
doomlist3 has quit [Ping timeout: 246 seconds]
<al2o3-cr>
ncakerlist: while will always be a loop
<adam12>
ncakerlist: while (line = getch); puts line; end
<adam12>
ncakerlist: In this case I'm cheating and performing an assignment inside the conditional. In Ruby, anything not false or nil is true. So the return value of gets would keep the loop going forever until aborted.
<adam12>
s/getch/gets/
<ncakerlist>
NameError (undefined local variable or method `getch' for main:Object)
<ncakerlist>
adam12: you write bad code
<ncakerlist>
ya gets
<ncakerlist>
this is a fundamental mistake and even a one-dayer on ruby can figure out
<ncakerlist>
by the way i like ruby's design different from python and willing to explore
<ncakerlist>
i also like the blocks concept
<al2o3-cr>
ncakerlist: STDIN.getch
<ncakerlist>
also i like Math.sqrt(9) works out of the box.. without require how does ruby not require modules
<al2o3-cr>
ncakerlist: 9 ** 0.5 too
<ncakerlist>
is there a file where i can pre-load module names
<al2o3-cr>
ncakerlist: autoload file
<ncakerlist>
thx
<al2o3-cr>
np
<al2o3-cr>
ncakerlist: autoload class, file
<ncakerlist>
|| works just like or? are they same
<ncakerlist>
I see i can use or,and just like ||,&&
<ncakerlist>
for booleans not bitwise
<al2o3-cr>
ncakerlist: || as higher precedence
<al2o3-cr>
same with &&
BTRE has quit [Remote host closed the connection]
<al2o3-cr>
ncakerlist: you'll love the block concept and never go back :P
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
dviola has quit [Quit: WeeChat 2.8]
dviola has joined #ruby
<al2o3-cr>
ncakerlist: why do you pass self to every method definition within a class in Python?
roadie has joined #ruby
<al2o3-cr>
ncakerlist: why do list comprehensions read backward
gix has joined #ruby
<al2o3-cr>
ncakerlist: and what's with all that whitespace? yuk!
roadie has quit [Ping timeout: 256 seconds]
<al2o3-cr>
anything python can do, ruby can do too. it's an interpeted language ffs.
ur5us has quit [Ping timeout: 260 seconds]
Garb0 has joined #ruby
chalkmonster has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
<rubydoc>
# => "implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly." (https://carc.in/#/r/98ww)
<havenwood>
snyp: It's a bit confusing because of the #send method name.
roadie has quit [Ping timeout: 272 seconds]
<havenwood>
snyp: In your example code, what is `p`?
<havenwood>
snyp: My guess is that you're calling Kernel#send not the method you're hoping.
r3m has quit [Quit: WeeChat 2.9-dev]
<havenwood>
snyp: Check: p.method(:send).owner
<havenwood>
snyp: Is it Kernel?
<havenwood>
snyp: Kernel#p is another method available on most objects. Is `p` a local variable here? It's the worst single letter to use as a variable.