howdoi has quit [Quit: Connection closed for inactivity]
nicholaslyang has joined #ruby
renich_ has joined #ruby
renich has quit [Ping timeout: 260 seconds]
renich_ is now known as renich
u0_a300 has joined #ruby
<u0_a300>
Hola?
<u0_a300>
Alguien esta?
renich has quit [Quit: renich]
cadeskywalker has quit [Read error: Connection reset by peer]
u0_a300 has quit [Quit: WeeChat 2.8]
<havenwood>
Sim, sempre.
u0_a309 has joined #ruby
chris____ has quit [Remote host closed the connection]
u0_a300 has joined #ruby
<u0_a300>
aqui estoy e.e
u0_a309 is now known as f1t
<u0_a300>
Hola? :C
<havenwood>
u0_a300: The convos here are mostly in English, but if you have Ruby for code review, to show off, or for help we're happy to assist if we can.
cliluw has quit [Ping timeout: 260 seconds]
<havenwood>
u0_a300: Welcome!
<havenwood>
u0_a300: Bem-vinda!
ChmEarl has quit [Quit: Leaving]
<u0_a300>
...
<u0_a300>
Por ala u.u
<havenwood>
u0_a300: Você tem dúvidas sobre Ruby?
<f1t>
Hey bros, what are you doing
<havenwood>
f1t: I'm not your bro, dude. I'm not your dude, pal.
<havenwood>
f1t: Ruby!
<f1t>
sorry
<havenwood>
f1t: Working on any interesting Ruby?
<havenwood>
f1t: Welcome!
<f1t>
Now I'm with CPAN of the Curl lenguage
<f1t>
Pearl*,sorry
<havenwood>
haha
<havenwood>
I was wondering what cURL lang was. :)
<havenwood>
And how it related to CPAN.
<f1t>
Is Comprehensive Perl Archive Network
<f1t>
it has 119118 modules to work with
xco has joined #ruby
<havenwood>
f1t: I know CPAN, but couldn't have told you what it stood for from memory.
vargonaut has joined #ruby
<f1t>
ah thats ok, now im studying the CPAN functions
<havenwood>
I would have guessed Camelia's Perl Access Node.
<f1t>
And what is ur next project, sir
<havenwood>
f1t: Currently trying to raise a human child.
yelloB has quit [Remote host closed the connection]
cnsvc_ has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
TCZ has quit [Quit: Leaving]
yelloB has joined #ruby
yelloB has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 256 seconds]
u0_a309 is now known as f1T
lazarus1 has joined #ruby
Chris__ has joined #ruby
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
plutes has quit [Ping timeout: 246 seconds]
Chris__ has quit [Ping timeout: 264 seconds]
u0_a309 has joined #ruby
f1T has quit [Read error: Connection reset by peer]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
plutes has joined #ruby
u0_a309 has quit [Quit: WeeChat 2.8]
nofxx__ has quit [Remote host closed the connection]
nofxx__ has joined #ruby
conta has quit [Quit: conta]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
sarna has quit [Quit: Connection closed]
donofrio has joined #ruby
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
nychtel has quit [Ping timeout: 246 seconds]
ChmEarl has joined #ruby
ho0po3 has quit [Quit: Leaving]
ho0po3 has joined #ruby
<AndreYuhai>
when I am trying to save a record in rails, if that record already exists in the DB how can I instead make my foreign key that existing records id instead of trying to add it? Because then I get duplicate error.
mdanielk has joined #ruby
<mdanielk>
hello
<mdanielk>
ohayyo
mdanielk has left #ruby [#ruby]
ho0po3 has quit [Client Quit]
SeepingN has joined #ruby
nicholaslyang has joined #ruby
duderonomy has quit [Ping timeout: 260 seconds]
nicholaslyang has quit [Client Quit]
quazimodo has quit [Ping timeout: 246 seconds]
duderonomy has joined #ruby
nychtel has joined #ruby
quazimodo has joined #ruby
duderonomy has quit [Ping timeout: 246 seconds]
duderonomy has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
infinityfye has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
cxl has quit [Quit: bye]
nychtel has quit [Read error: Connection reset by peer]
nicholaslyang has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
renich has joined #ruby
akem has joined #ruby
rippa has joined #ruby
renich has quit [Ping timeout: 256 seconds]
renich has joined #ruby
quazimodo has quit [Ping timeout: 258 seconds]
schne1der has quit [Ping timeout: 246 seconds]
quazimodo has joined #ruby
davispuh has joined #ruby
fercell has joined #ruby
nicholaslyang has joined #ruby
mydog2 has quit [Ping timeout: 265 seconds]
nicholaslyang has quit [Client Quit]
cd has joined #ruby
mydog2 has joined #ruby
cxl has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
TomyWork has quit [Remote host closed the connection]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lazarus1 has quit [Quit: Leaving]
nicholaslyang has joined #ruby
nicholaslyang has quit [Client Quit]
chris____ has joined #ruby
Secret-Fire has quit [Remote host closed the connection]
doomlist3 has joined #ruby
Xatenev has joined #ruby
Xatenev has left #ruby [#ruby]
<doomlist3>
ruby in ubuntu i opened 2*8 gives error
<doomlist3>
sorry it doesn't display the output
<adam12>
doomlist3: Are you looking for `irb`?
<doomlist3>
oh yes
<doomlist3>
but why does ruby behave exactly then how to use it
<doomlist3>
just wondering why it;s unusable
<doomlist3>
is it a script mode
<doomlist3>
instead of interactive mode
<adam12>
doomlist3: The ruby command normally runs a file. When run without a file, it reads that file from stdin.
<doomlist3>
ruby file ; like that
nicholaslyang has joined #ruby
<doomlist3>
okay
<adam12>
doomlist3: So you could do something similar; run ruby, then type puts 2*8 then press ctrl-d.
<doomlist3>
i am learning ruby right now as i talk i am python background
<adam12>
doomlist3: Ah yeah. Python will run a REPL when no file is given. I'm not sure why Ruby differs there but it does.
<adam12>
doomlist3: Ruby also has more than one REPL; irb being the built-in one and pry being a little more featureful.
SeepingN has joined #ruby
Secret-Fire has joined #ruby
nicholaslyang has quit [Client Quit]
jenrzzz has joined #ruby
Secret-Fire has quit [Max SendQ exceeded]
<phaul>
although new irb is really becoming awesome
<phaul>
with the multi line edit
<adam12>
Definitely.
Secret-Fire has joined #ruby
<doomlist3>
phaul: multi line cool
<doomlist3>
i see only one line
<doomlist3>
can i change it's mode
<adam12>
doomlist3: You'll enter multi-line mode if the expression supports it. Ie. inside a block or if statement.
<phaul>
first which ruby version are you on. because it's kind of new
<adam12>
doomlist3: This also depends on your Ruby version, since only very recent versions of irb support it. Ruby 2.7+ likely.
<doomlist3>
python too does the same then i want it to be more line truly browsable like up and down the cells
<doomlist3>
just like in a file
<adam12>
havenwood: I'll be happy to see arg delegation.
nychtel has quit [Ping timeout: 260 seconds]
<adam12>
havenwood: I also wonder if the new 'require' proposal will go anywhere. Seems there's concern of callable's inside $LOAD_PATH for breakage, but load times seems to be an issue for me lately on one of my projects.
<doomlist3>
i can't go up if i want to edit the code like with cells
<doomlist3>
i am just learning ruby and it feels easier than python already because in methods x.method is fine without () as x.method()
<doomlist3>
adam12: in browseri am doing
<doomlist3>
ruby feels easier than python in terms of typing for these things
<doomlist3>
i think i can learn ruby in a day or two
conta has joined #ruby
<baweaver>
Ah, yes, one can learn the fundamentals of a language in days
<baweaver>
but much like chess it takes years to master
<doomlist3>
baweaver: guys i am finding because of the 20 min tutorial learning is much easier than python's tutorial
<doomlist3>
this is like child's play 20 minutes maybe 40 minutes but still it's nothing i wasted two months to learn basics of python
<baweaver>
Consider the very real chance that it's easy because you know Python.
<baweaver>
The two aren't that far apart.
nicholaslyang has joined #ruby
<doomlist3>
not really 3months is a lot verses 30 minutes
<doomlist3>
the tutorial quality makes or breaks things
nicholaslyang has quit [Client Quit]
gix has joined #ruby
<doomlist3>
baweaver: i came here to check the behaviour of ruby
<doomlist3>
x=[[1]]*2
<doomlist3>
x[0].append(3) what's the syntax for that in ruby
orbyt_ has joined #ruby
conta has quit [Ping timeout: 260 seconds]
conta has joined #ruby
<adam12>
doomlist3: XY question. What did you want the end result to be?
<doomlist3>
adam12: ok here goes the story
<adam12>
doomlist3: Remember that we're in #ruby and not everyone is familiar with Python :)
<doomlist3>
in python add=[[1]]*2 gives [[1],[1] ] now add[0].append(3) gives [[1,3],[1,3]] i find this unsettling so how does ruby solve this issue using the principle of least surprise
<doomlist3>
add[0] and add[1] are the same objects in py but not in ruby which is cool
<adam12>
doomlist3: Oh I see. Interesting scenario.
<adam12>
doomlist3: Ruby does pass some things by reference and some things by value.
<adam12>
doomlist3: In this case, you're probably going to see the same result as Python.
<adam12>
doomlist3: That said, there are ways to work around this, but maybe not for this example. Commonly, Hash and Array will accept a default value in both argument and block form. If you use the argument, there's risk of the same object being re-used as you've shown above. If you use the block form, a new object is returned each time so there's no chance of re-use.
<doomlist3>
adam12: no i don't upon multiply the samse list or adding those objects are different
<doomlist3>
what's the cmd to check if two objs are different or same
<doomlist3>
and then obj1.object_id == obj2.object_id is there a shorter way
<doomlist3>
a is b ....
<adam12>
doomlist3: There might be but I'm not familiar with it. I don't normally care about these things in my day to day :)
<doomlist3>
adam12: so ruby users don't check a is b .... unlike python users' ...
<adam12>
Maybe Object#equal?
cadeskywalker has joined #ruby
<adam12>
obj1.equal?(obj2)
<adam12>
doomlist3: A few different ways to check things in Ruby, but normally object_id isn't often one of them (at least for me).
<adam12>
doomlist3: If you give an example maybe I could try to come up with one comparable. Ruby has a very powerful case/when construct, which uses ===. So in the same case statement you can pass values, classes, conditions, and soon pattern matches.
<doomlist3>
adam12: obj.equal? obj2 ruby is much more complex how long you been into it, you seem like a little down
<adam12>
doomlist3: I've been writing Ruby since 2005.
<doomlist3>
al2o3-cr: Math.srqt does not need require
<al2o3-cr>
doomlist3: no
<doomlist3>
a newbie query what is p begin *code* end
<doomlist3>
fwhy it's needed
<adam12>
doomlist3: It's likely not needed, but I'm guessing you're following some sort of tutorial inside irb?
conta has quit [Quit: conta]
<adam12>
doomlist3: p is from Kernel (https://rubyapi.org/2.7/o/kernel#method-i-p), and the begin / end is a code block. So it's outputing the inspected output of the block result.
<al2o3-cr>
or they're looking at carn.in results, then it's purely for the purpose of the bot.
<adam12>
al2o3-cr: Oh interesting! I didn't realize it wrapped it.
<al2o3-cr>
adam12: yup.
<doomlist3>
there is case, until,when and all that crap it's not clean
<doomlist3>
until is just while not
nychtel has joined #ruby
<adam12>
doomlist3: Ruby has many ways to write things. Not sure why it wouldn't be clean; the words used portray the semantics of the code. You're free to use the incarnation you want, and use something Rubocop to enforce it team-wide.
<doomlist3>
S = Struct.new(:name, :state) does rb seriously has structures like C? i mean it's not minimalistic like python...
<doomlist3>
i just discovered single quotes are literal quotes and double quotes not, not same ...crap
<doomlist3>
this is getting crappy and it's been just an hour to ruby 40 minutes of which were spent browsing and chatting
<havenwood>
doomlist3: Ruby guides you towards the preferred path by gilding it with pretty literals and concise code. If you find it's not lovely, ask here about what you're trying to do.
<havenwood>
doomlist3: Structs will get some love in Ruby 3+.
<havenwood>
doomlist3: If you don't like more than one way to do it, Ruby is not a language for you.
<havenwood>
TIMTOWTDI.
rainmanjam has quit []
<havenwood>
doomlist3: It not being what you're used to doesn't make it wrong. Live a little.
<havenwood>
doomlist3: If you'd like to reign in options a bit but keep some of the Ruby spirit, try Elixir.
<doomlist3>
options?
<havenwood>
doomlist3: More than one way to do it.
<havenwood>
doomlist3: Aliases, similar functions, and the general principle of There Is More Than One Way To Do It.
u0_a309 has joined #ruby
<doomlist3>
havenwood: until is just while not
xco has joined #ruby
<havenwood>
doomlist3: Right. And that's fine!
<doomlist3>
it's the same way in different tongues
Chris__ has joined #ruby
<havenwood>
doomlist3: This language is not Python. It has a different philosophy.
<havenwood>
doomlist3: You're telling us that Ruby doesn't follow "The Zen of Python." That is correct.
<doomlist3>
i am arguing just saying it's not minimalistic . it's my philosophy nothing to do with python, with common lisp too i say the same thing it's just bloated i say.. i never compare
<havenwood>
doomlist3: Some languages like Python explicitly call for no more than one way to do things (see `import this`). "There should be one — and preferably only one — obvious way to do it."
<doomlist3>
C++ and common lisp are bloated?
<havenwood>
doomlist3: Ruby comes from the LISP tradition.
<havenwood>
doomlist3: TIMTOWDI is from Perl.
<doomlist3>
ya and the bloatware is from ruby
<havenwood>
doomlist3: Whine all you like, but this is an intentional philosophical choice.
<havenwood>
doomlist3: You're using a language with more than one way to do it (English) to argue that Ruby should be Python. ¯\_(ツ)_/¯ You do you!
Secret-Fire has quit [Remote host closed the connection]
Chris__ has quit [Ping timeout: 260 seconds]
Secret-Fire has joined #ruby
rainmanjam has joined #ruby
<apotheon>
I think doomlist3 should just not use Ruby, then.
jenrzzz has joined #ruby
<apotheon>
doomlist3: I like simpler designs, all else being equal, too -- but all else is not equal here, and Ruby has a lot of advantages. If you don't like those advantages, you're using the wrong language, unless you're willing to learn to like those advantages.
<doomlist3>
apotheon: i will learn ruby by tommorroow
<apotheon>
doomlist3: Another thing I like is consistency, which Python violates pretty badly in some ways. I don't like Python's advantages enough to overcome my distaste for its disadvantages. I'd rather write C (which I also like a lot) than Python for anything that isn't better handled by Ruby, so if your thinking is more Python-oriented, and mine is more C- and Ruby-oriented, I guess we should just
<doomlist3>
i was seeing gets.chomp wtf chomp o_0
<apotheon>
use different languages, and not pick fights over them.
<apotheon>
WTF your insistence on WTFing all over the place
<apotheon>
Please be nice.
<doomlist3>
o_)
jenrzzz has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
sysh has quit [Remote host closed the connection]
<reyfi9e>
what's weird about chomp? ruby isn't the first language to call it that...
Secret-Fire has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 264 seconds]
Secret-Fire has joined #ruby
SuperL4g has joined #ruby
gell5 has joined #ruby
<doomlist3>
p looks like an alias for puts what's the cmd to find aliases
SuperLag has quit [Ping timeout: 272 seconds]
umar has joined #ruby
gell5 has quit [Ping timeout: 240 seconds]
<umar>
hi
<phaul>
they are not aliases they do different things