knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chouhoulis has joined #ruby
rundor has quit [Remote host closed the connection]
rundor has joined #ruby
rundor_ has joined #ruby
vondruch has quit [Remote host closed the connection]
vondruch has joined #ruby
contradictioned has quit [Ping timeout: 240 seconds]
rundor has quit [Ping timeout: 260 seconds]
vondruch has quit [Remote host closed the connection]
vondruch has joined #ruby
InfinityFye has quit [Ping timeout: 260 seconds]
jackjackdripper has joined #ruby
__Yiota has joined #ruby
mim1k has joined #ruby
charliesome has joined #ruby
rundor_ has quit [Remote host closed the connection]
vondruch has quit [Remote host closed the connection]
vondruch has joined #ruby
rundor has joined #ruby
rwb has joined #ruby
bkxd has quit [Ping timeout: 248 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
bkxd_ has quit [Ping timeout: 248 seconds]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mim1k has quit [Ping timeout: 260 seconds]
rundor_ has joined #ruby
rundor has quit [Ping timeout: 260 seconds]
jackjackdripper has quit [Quit: Leaving.]
comet23 has joined #ruby
<comet23>
what is a mature object?
lamduh has quit [Ping timeout: 248 seconds]
duderonomy has quit [Ping timeout: 248 seconds]
tunaBee_ has quit [Ping timeout: 248 seconds]
rivalomega has quit [Read error: Connection reset by peer]
<havenwood>
comet23: hard to say without some context
<havenwood>
comet23: why are you asking? where'd you hear that?
bronson has joined #ruby
rivalomega has joined #ruby
rfoust has joined #ruby
<havenwood>
comet23: the only thing i can think is that you mean in terms of the GC? like it's young if it hasn't survived a sweep and mature if it has. is that what you mean?
rivalomega has quit [Remote host closed the connection]
gusrub has quit []
<havenwood>
(We actually have a tricolor GC now.)
hahuang65 has joined #ruby
contradictioned has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
hahuang65 has quit [Ping timeout: 260 seconds]
kculpis has joined #ruby
zapata has quit [Ping timeout: 246 seconds]
tunaBee has joined #ruby
AX31_A13X has joined #ruby
Azure has quit [Ping timeout: 240 seconds]
Azure has joined #ruby
AxelAlex has quit [Ping timeout: 268 seconds]
antgel has quit [Ping timeout: 240 seconds]
iomotoko has joined #ruby
_whitelogger has joined #ruby
gizmore|2 has joined #ruby
zapata has joined #ruby
reino4477 has joined #ruby
reino4477 has left #ruby [#ruby]
gizmore has quit [Ping timeout: 268 seconds]
ascarter has joined #ruby
lacuna has joined #ruby
sepp2k has quit [Read error: Connection reset by peer]
<tau>
is eventmachine still in use? i mean is it still hot?
<tau>
or are there any other choices?
jdawgaz has joined #ruby
tohsaka_ has left #ruby ["Leaving"]
tohsaka_ has joined #ruby
<matthewd>
tau: Depends what you want to do
<tau>
mattewd lets say an ircbot
<tohsaka_>
unzip intern.hct -d ~/.config/hexchat
<tohsaka_>
ckear
<tohsaka_>
ks
<tohsaka_>
woops sorry
<comet23>
Thank you everyone
<comet23>
I figured it out and it was much simpler than I thought
<comet23>
Have a great night I'm off to bed
jdawgaz has quit [Client Quit]
<matthewd>
tau: If you specifically want something that can handle multiple connections per thread, you might look at nio4r, or async/socketry (I'm not familiar with those, but I believe they're in the same solution space). But unless you're making an IRC *server*, I'd personally just go with a straight threaded model.
<tau>
i see.
tohsaka_ has quit [Read error: Connection reset by peer]
<tau>
mattewd i'll consider that.
noe has joined #ruby
bronson has joined #ruby
comet23 has quit [Ping timeout: 240 seconds]
uZiel has quit [Ping timeout: 248 seconds]
Bock has joined #ruby
noe has quit [Client Quit]
apparition has joined #ruby
hahuang65 has joined #ruby
bronson has quit [Ping timeout: 276 seconds]
hahuang65 has quit [Ping timeout: 240 seconds]
postmodern has quit [Quit: Leaving]
daivyk has quit [Ping timeout: 255 seconds]
mim1k has joined #ruby
bkxd has quit [Ping timeout: 248 seconds]
bkxd_ has quit [Ping timeout: 248 seconds]
mim1k has quit [Ping timeout: 255 seconds]
hahuang65 has joined #ruby
hndk has quit [Read error: Connection reset by peer]
hndk has joined #ruby
hahuang65 has quit [Ping timeout: 260 seconds]
bkxd has joined #ruby
bkxd_ has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
bkxd has joined #ruby
bkxd_ has quit [Ping timeout: 240 seconds]
bkxd_ has joined #ruby
vondruch has quit [Remote host closed the connection]
vondruch has joined #ruby
br0d1n has quit [Quit: Leaving]
uZiel has joined #ruby
eightlimbed has quit [Ping timeout: 260 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hahuang65 has joined #ruby
andrzejku has joined #ruby
hotpancakes has joined #ruby
bkxd_ has quit [Ping timeout: 260 seconds]
bkxd has quit [Ping timeout: 260 seconds]
hahuang65 has quit [Ping timeout: 248 seconds]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Talltree_ has quit [Ping timeout: 268 seconds]
Timba-as has joined #ruby
konsolebox has quit [Ping timeout: 268 seconds]
hotpancakes has quit [Ping timeout: 276 seconds]
cam27 has quit [Quit: cam27]
konsolebox has joined #ruby
tau has quit [Remote host closed the connection]
ruby-lang683 has joined #ruby
<ruby-lang683>
can anyone have a quick gander at my code if i put it on gist? its angry about some `end` i have, but i'm pretty sure i need it
<elomatreb>
Post it, if someone has time they will respond
vondruch has quit [Remote host closed the connection]
vondruch has joined #ruby
br0d1n has joined #ruby
comet23 has joined #ruby
<comet23>
why are constants mutable?
<apeiros>
because matz decided they should be
<apeiros>
also note that "constant" means "references the same object constantly" (though you can even assign a new object to a constant, all you get is a warning - or you can use remove_const+const_set)
<ytti>
ruby philosophically wants to allow maximum metaprogramming
<ytti>
it is definitely double edged sword
<ytti>
but in this philosophy it would be silly to completely remove ability to do something
<ytti>
you may be using library which is using const, which shouldn't be const
<ytti>
and you'll avoid forking that library with bit of nasty monkey patching
<ytti>
not inherently good or bad, just one philosophy
Ishido has quit [Ping timeout: 240 seconds]
cam27 has joined #ruby
jameser has joined #ruby
rivalomega has joined #ruby
<comet23>
Thank you
Silthias has joined #ruby
bkxd_ has quit [Ping timeout: 240 seconds]
eightlimbed has joined #ruby
Silthias has left #ruby [#ruby]
bkxd has quit [Ping timeout: 240 seconds]
rivalomega has quit [Ping timeout: 255 seconds]
<comet23>
How can I improve this method?
<comet23>
def brand=(name)
<comet23>
end
<comet23>
BRANDS << name if BRANDS.include?(name) == false
bronson has quit [Remote host closed the connection]
Dimik has joined #ruby
jeffreylevesque_ has joined #ruby
vuoto has quit [Remote host closed the connection]
eightlimbed has quit [Quit: Ex-Chat]
BillyTheKid has quit [Remote host closed the connection]
<Papierkorb>
comet23: use `unless` instead of `if`
<Papierkorb>
comet23: Also, it might not be obvious at all to a user that `brand=` doesn't set the brand, but adds it to a constant, which is also highly questionable
<comet23>
is this a highly questionable method too?
<comet23>
def genre=(genre)
<Papierkorb>
comet23: This is much more obvious, and also better to test: `def add_brand(name); @brands << name unless @brands.include?(name); end`
<Papierkorb>
Yes I wouldn't want that method in my code base.
apparition has quit [Quit: Bye]
<comet23>
what would you use instead?
<Papierkorb>
Hard to say without context. But writer methods (as in `foo=`) are generally expected to just set a value, maybe a sanity check on the new value, but that's really it it should do.
<Papierkorb>
Also, changing the value of a CONSTANT is never a great idea
bronson has joined #ruby
bronson has quit [Remote host closed the connection]
<comet23>
but as I understood just now a constant in Ruby is unlike other languages... it simply means a variable that is constantly accessed
<Papierkorb>
Ruby allows to do pretty much anything. Doesn't mean it's a good idea to do that "pretty much anything" though.
Dimik has quit [Ping timeout: 240 seconds]
<Papierkorb>
And a CONSTANT is constant. Hence the name. If you need something that is variable in value, use a variable.
* apeiros
disagrees
<apeiros>
and seems matz to
<comet23>
apeiros said that a constant is variable that is constantly accessed
<apeiros>
*too
<apeiros>
not constantly accessed
<apeiros>
constantly referencing the same object
<comet23>
what's the difference?
<apeiros>
but even that is only a half-truth in ruby
<apeiros>
comet23: if this wording isn't clear to you, then I don't know how to explain. maybe you need somebody who can translate both to your mother tongue.
<apeiros>
Papierkorb: anyway, if you want immutable objects, #freeze is the way to go
<comet23>
i thought everything is an object in ruby
<Papierkorb>
apeiros: Yeah I generally freeze anything in a constant, if possible
<apeiros>
you can get an object representing a method, though
<apeiros>
blocks aren't either. but you can turn them into Proc instances.
<comet23>
the difference between a class and an object is that an object is a name for a class that has been initialized?
rkellermeyer has joined #ruby
<apeiros>
classes are objects
<comet23>
class = blueprint and object = initialized blueprint?
<comet23>
this is so confusing
<comet23>
just when i thought i understood stuff
<apeiros>
the difference between non-class objects and classes is that the class of a non-class object isn't a subclass of Class
<apeiros>
err, *is* a subclass
<comet23>
so what is the difference between a class and an object
<apeiros>
all objects are instances of their class
<apeiros>
Array.new.instance_of?(Array)
<apeiros>
Array.is_a?(Class) # => true
<comet23>
okay great, i was right
<apeiros>
Array.new.is_a?(Class) # => false
<comet23>
but that's not what i said?
<apeiros>
but: Array.is_a?(Object) # => true
<Papierkorb>
comet23: A constant is not totally unlike a variable: Both point to an object. Consider this code: `a = "hello"; b = a; b << " you"; puts a` - In here, a and b both point (or refer) to the same object (A String in this case). That's why we split the definition of a variable from a value, because many things can refer to the same value at any given time. A CONSTANT and a variable both refer to a value. The key difference now is a constant in
<Papierkorb>
itself is constant: It always refers to the same value (might be any object). Consider this code: `FOO = "hi"; bar = "ho"` You can't change what FOO refers to afterwards (*), but you can easily what bar refers to afterwards. { (*) = Of course, ruby being ruby, you can change it. Avoid if possible. }
<apeiros>
comet23: and yes, classes are the blueprints
<apeiros>
what you said was slightly wrong because it implied classes weren't objects.
vuoto has joined #ruby
<comet23>
i thought they weren't until they became instances of some variable
<apeiros>
nothing becomes an instance of a variable
<apeiros>
the only things which have instances are classes
<Papierkorb>
comet23: However, as a constant points to an object, you can /change/ the state of this object. `FOO = []; FOO << "hi"` Is valid: You don't change what FOO points to (It's still the same Array object in this case!), but you change the state of the pointed-to (referred-to) array.
<apeiros>
variables only *reference* things
<comet23>
i mean before dong bike = Bike.new()
<apeiros>
and those things are objects
<apeiros>
and those objects can be classes
<apeiros>
and classes are usually assigned to constants. they don't have to be, though.
<apeiros>
there are some optimized cases, but in general, this is true.
<apeiros>
those are called literals. where the object is literally written in your code. it's not constructed e.g. from IO.
* apeiros
afk for a bit
<comet23>
I want to impress my technical interviewers when I'm going out job hunting. I want them to see that someone without a college degree can be knowledgeable too. Thank you for your help
<apeiros>
without the thread.join, the "At the end of thread" won't be printed
<apeiros>
since ruby only waits for the main thread to terminate, it doesn't care about other threads.
<impermanence>
what you're saying surprises me because The Well Grounded is generally regarded as one of the finest books on Ruby every written (I think?)
<apeiros>
I bet there are errata
<impermanence>
not criticising anyone...I'm just like..."huh"...
<impermanence>
oh yeah, bet you're right
<impermanence>
yeah your second gist revision is where the author heads next
<impermanence>
What is it about join that makes it the function we need to use (for threads)?
<impermanence>
I usually only think about it in terms of strings and such
<apeiros>
I guess the author wanted to demonstrate that "At the end of the thread" is not printed
<apeiros>
Thread#join says "wait here until that thread has finished executing"
<apeiros>
you can alternatively use Thread#value, which will also evaluate to the last value in the thread.
<apeiros>
e.g. Thread.new { x = 3; y = 2; x+y }.value # => 5
<apeiros>
&ri Thread impermanence
<apeiros>
oy, derpy is dead :( poor bot
<impermanence>
derpy is a legen name though, lol
<impermanence>
legend
<apeiros>
and its master isn't around either! :-O
<impermanence>
btw...the additional "sleep 0.5" from your first gist revision was enough to get that first puts to stdout
<apeiros>
impermanence: because threads run concurrently
<apeiros>
and the sleep makes the main thread wait for half a second
<apeiros>
so the thread you spawned has a chance to print first
<impermanence>
oh. so like a thread fight?
<apeiros>
if you don't sleep, the result is not really determined. it depends on what ruby schedules first.
<apeiros>
it can even happen that the print operation is interleaved. then you get garbled output.
<impermanence>
interesting
<apeiros>
though, to ensure that two threads do NOT run concurrently, you shouldn't really ever use sleep. there are tools for that. e.g. Mutex. but I bet the author will get there too.
* apeiros
afk for a bit
<impermanence>
so how does one write Ruby code that cooperates or intuits the scheduler?
ttilley has joined #ruby
dasher00 has joined #ruby
ttilley has quit [Changing host]
ttilley has joined #ruby
hotpanca_ has quit [Remote host closed the connection]
hotpancakes has joined #ruby
rohitpaulk has quit [Ping timeout: 240 seconds]
mim1k has quit [Ping timeout: 240 seconds]
<apeiros>
impermanence: pretty sure the author will explain ;-)
hndk has quit [Ping timeout: 240 seconds]
<impermanence>
yaa, reading the Thread class in core rn so I'm getting up to spizzeed.
<havenwood>
impermanence: If you don't have any shared state it's not too bad at all!
<havenwood>
impermanence: Jesse Storimer wrote a book on Ruby Threads that's a great introduction.
<havenwood>
Like an Erlang process or Goroutine in Ruby.
<impermanence>
havenwood: uh...I thought green threads were always a thing for Ruby though?
<havenwood>
impermanence: Ruby had green threads in 1.8, but they could only use one core.
<havenwood>
impermanence: Ruby started to map threads one-to-one to system threads in 1.9, but they're sometimes limited from running in parallel by the GVL (also called GIL).
<havenwood>
impermanence: The green threads in 1.8 kinda became what is Fiber in 1.9, but they have to be scheduled by the programmer.
universal has joined #ruby
universa1 has quit [Ping timeout: 255 seconds]
bronson has joined #ruby
rohitpaulk has joined #ruby
<impermanence>
havenwood: wow, that Storimer link is excellent! I wish I had bought that Unix book he wrote instead of this other one I bought.
<havenwood>
impermanence: normalperson implemented green threads for future Ruby that are evented, self-scheduling Fibers.
hotpancakes has joined #ruby
<havenwood>
impermanence: They're great books. I recommend all three.
aglorei has quit [Ping timeout: 248 seconds]
pmden has quit [Ping timeout: 255 seconds]
bronson has quit [Ping timeout: 246 seconds]
mokiwis has joined #ruby
aglorei has joined #ruby
oleo has quit [Read error: Connection reset by peer]
hndk has joined #ruby
_aeris_ has joined #ruby
pmden has joined #ruby
hays_ has quit [Ping timeout: 260 seconds]
pmden has quit [Ping timeout: 240 seconds]
eightlimbed has joined #ruby
mrconfused has joined #ruby
pmden has joined #ruby
AxelAlex has quit [Quit: AxelAlex]
nanoz has joined #ruby
nanoz has joined #ruby
nanoz has quit [Changing host]
<eightlimbed>
Does anyone know of a gem that handles audio recording? I'm looking for something that can pick up a recording and export a wav of flac file.
blackwind_123 has quit [Ping timeout: 260 seconds]
mokiwis has quit [Quit: See ya!]
jpinnix has left #ruby [#ruby]
blackwind_123 has joined #ruby
gheegh has joined #ruby
rundor has quit [Remote host closed the connection]
rundor has joined #ruby
Timba-as has joined #ruby
vondruch has quit [Remote host closed the connection]
vondruch has joined #ruby
hotpancakes has quit [Remote host closed the connection]
hotpancakes has joined #ruby
DeeJayh__ has quit [Ping timeout: 260 seconds]
nanoz has quit [Quit: <3]
rundor has quit [Remote host closed the connection]
rundor has joined #ruby
patarr has joined #ruby
rundor has quit [Remote host closed the connection]
rundor has joined #ruby
rundor has quit [Remote host closed the connection]
rundor has joined #ruby
rundor has quit [Remote host closed the connection]
rundor has joined #ruby
rundor has quit [Remote host closed the connection]
hotpanca_ has joined #ruby
rundor has joined #ruby
rundor has quit [Remote host closed the connection]
hotpancakes has quit [Ping timeout: 246 seconds]
Antiarc has quit [Ping timeout: 248 seconds]
al2o3-cr has quit [Ping timeout: 255 seconds]
Antiarc has joined #ruby
dasher00 has quit [Ping timeout: 255 seconds]
gr33n7007h has joined #ruby
gr33n7007h is now known as al2o3-cr
daivyk has quit [Ping timeout: 240 seconds]
dasher00 has joined #ruby
bronson has joined #ruby
Coldblackice has joined #ruby
Coldblackice has quit [Client Quit]
bronson has quit [Ping timeout: 248 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
patarr has quit [Ping timeout: 248 seconds]
InfinityFye has quit [Quit: Leaving]
_aeris_ has quit [Remote host closed the connection]
mrconfused has quit [Ping timeout: 255 seconds]
_aeris_ has joined #ruby
synion has quit [Quit: Leaving]
synion__ has quit [Quit: Leaving]
dennisvennink has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Saifulapm>
No.. I don't know what is REXML .. I am learning Ruby
<apeiros>
do you use REXML?
<apeiros>
then you don't need dclone and probably don't have it
<Saifulapm>
ok. But What is REXML ?
<apeiros>
classes in ruby are open, means that any library can add additional methods to existing classes. rexml apparently adds dclone to Array (and probably others)
<apeiros>
rexml is an xml parser shipping with ruby, it's part of its standard library
<apeiros>
so maybe a better question now is: what did you want to use dclone for?
<Saifulapm>
Yes
<apeiros>
interesting answer to a "what" question…
rgtk has joined #ruby
Nicmavr has quit [Ping timeout: 246 seconds]
rgtk has quit [Client Quit]
rgtk has joined #ruby
Nicmavr has joined #ruby
<Saifulapm>
I didn't find any use of dclone() in google. :(
Nicmavr is now known as Guest82335
bronson has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
centrx has quit []
hotpanca_ has quit []
<apeiros>
Saifulapm: what problem are you trying to solve?
bronson has quit [Ping timeout: 240 seconds]
aclark has quit [Remote host closed the connection]
<Saifulapm>
Actually I am learning now Ruby from ruby-doc website. In Array class, I found this method. In Ruby doc , no example for this method. Also I have searched in google for example of this method. Just I am playing with Ruby