dmitriy_ has quit [Read error: Connection reset by peer]
arescorpio has joined #ruby
<leitz>
Added a comment with the start of the chapter, showing what it was before the new file was written.
tjbp has quit [Ping timeout: 260 seconds]
fribmendes has quit [Quit: fribmendes]
tjbp has joined #ruby
apeiros has quit [Ping timeout: 240 seconds]
<leitz>
one part I don't understand is the characters; I checked "new_file_name" as I wrote the code, and whatever \357\273\277 are they aren't showing up as printable.
John_Ivan has quit [Read error: Connection reset by peer]
arkymad has joined #ruby
<leitz>
BOM; Byte order marking. From a stack overflow on C.
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
<leitz>
Which is one of the reasons I don't like UTF-8.
n0m4d1c has quit [Read error: Connection reset by peer]
ikopico_ has joined #ruby
n0m4d1c has joined #ruby
<mozzarella>
weird
<leitz>
The BOM or me not liking UTF-8? :)
apeiros has joined #ruby
eckhardt has joined #ruby
eckhardt has quit [Client Quit]
arkymad has quit [Remote host closed the connection]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
naprimer has quit [Ping timeout: 240 seconds]
naprimer has joined #ruby
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kapil___ has joined #ruby
apeiros has quit [Ping timeout: 260 seconds]
Psybur has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
jottr has joined #ruby
jottr_ has quit [Ping timeout: 265 seconds]
n0m4d1c has quit [Ping timeout: 256 seconds]
hahuang65 has quit [Quit: WeeChat 2.0.1]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
hahuang65 has joined #ruby
cadillac_ has quit [Ping timeout: 240 seconds]
<leitz>
And this removed the entire line. new_file_name = new_file_name.delete("^\xEF\xBB\xBF")
<leitz>
Ugh.
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
hahuang61 has joined #ruby
cadillac_ has joined #ruby
n0m4d1c has joined #ruby
hahuang65 has quit [Quit: WeeChat 2.0.1]
hahuang65 has joined #ruby
ts__ has quit [Quit: Leaving]
konsolebox has quit [Ping timeout: 240 seconds]
hahuang65 has quit [Client Quit]
apeiros has joined #ruby
<leitz>
This seems to work: new_file_name = new_file_name.gsub(/.*\[/, '[')
hahuang65 has joined #ruby
hahuang61 has quit [Ping timeout: 252 seconds]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
konsolebox has joined #ruby
Mr_Tea has joined #ruby
hahuang65 has quit [Client Quit]
hahuang65 has joined #ruby
hahuang65 has quit [Client Quit]
apeiros has quit [Ping timeout: 245 seconds]
milardovich has quit [Remote host closed the connection]
<thesubr00t>
dminuoso, here is the spec file so far export_survey_responses_service.rb
hahuang65 has quit [Ping timeout: 240 seconds]
<dminuoso>
thesubr00t: Though strictly speaking I wouldnt have any "Service" module to begin with.
<dminuoso>
"Service" is a ruby way of saying "global singleton"
<thesubr00t>
dminuoso, Its a Rails service
<dminuoso>
thesubr00t: Still.
<dminuoso>
thesubr00t: Global singletons create invisible dependencies and hidden global state.
tvw has joined #ruby
<thesubr00t>
dminuoso, So how should I implement that?
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
thesubr00t: You just pass things. Services are to controllers what helpers are to views.
<thesubr00t>
dminuoso, Ok thanks :)
mtkd has quit [Ping timeout: 248 seconds]
<dminuoso>
thesubr00t: Thats my personal opinion anyhow. The majority of rails people seem to be sold on the idea of using global mutable state to solve problem, magically injected globally available helpers, and invisible callbacks to control behavior.
<thesubr00t>
dminuoso, I get your opinion :)
mtkd has joined #ruby
raynold has quit [Quit: Connection closed for inactivity]
sidx64 has joined #ruby
ianmalcolm has quit [Remote host closed the connection]
ianmalcolm_ has joined #ruby
<tbuehlmann>
I'm okay with "services" or command objects ¯\_(ツ)_/¯
sidx64 has quit [Client Quit]
hahuang65 has joined #ruby
<dminuoso>
tbuehlmann: command objects - you mean "functions" right? :P
Cavallari has joined #ruby
<dminuoso>
tbuehlmann: The thing is, they tend to be easier to test. Assume some: def Q.conn(config); @conn ||= Connection.new(config); end;
<dminuoso>
This is just memoization, I dont mind this.
Papierkorb has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
alfiemax_ has joined #ruby
thesubr00t has quit [Quit: Ex-Chat]
drewmcmillan has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
sidx64 has joined #ruby
rrutkowski has joined #ruby
milardovich has joined #ruby
phaul has joined #ruby
logoscoder_ has quit [Read error: Connection reset by peer]
logoscoder_ has joined #ruby
rrutkowski has quit [Client Quit]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rrutkowski has joined #ruby
hahuang61 has joined #ruby
hahuang61 has quit [Ping timeout: 252 seconds]
karapetyan has joined #ruby
ramfjord has joined #ruby
schneider- has joined #ruby
jottr_ is now known as jottr
InfinityFye has joined #ruby
karapetyan has quit [Ping timeout: 256 seconds]
InfinityFye has left #ruby [#ruby]
ramfjord has quit [Ping timeout: 252 seconds]
shinnya has joined #ruby
sidx64 has joined #ruby
jenrzzz has joined #ruby
ldnunes has joined #ruby
hahuang65 has joined #ruby
bigblind has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
bigblind has quit [Ping timeout: 240 seconds]
Psybur has joined #ruby
Psybur has joined #ruby
Psybur has quit [Changing host]
suukim has joined #ruby
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Papierkorb has left #ruby ["Konversation terminated!"]
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang65 has quit [Ping timeout: 260 seconds]
Mike11 has quit [Ping timeout: 240 seconds]
<tbuehlmann>
dminuoso: eventually a service becomes a lambda, yep
milardovich has quit [Ping timeout: 260 seconds]
drewmcmillan has joined #ruby
sidx64 has joined #ruby
ferr1 has left #ruby ["WeeChat 2.0.1"]
<leitz>
Hmm..I thought methods had access to variables defined in an outer scope, assuming the method didn't declare its own variable with the same name.
wojnar has joined #ruby
hahuang65 has joined #ruby
<darix>
leitz: no
<darix>
why would they?
<leitz>
darix, so you didn't have to redefine dozens of variables used by multiple methods?
logoscoder_ has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 252 seconds]
<apeiros>
leitz: that's what you use object state for, via @instance_variables
<leitz>
Doesn't seem like a good object candidate though.
<apeiros>
don't know what "it" is, so can't comment on that.
<apeiros>
but if you have dozens of variables which are all accessed by multiple methods, then there are certainly one to many candidates for classes in there.
<leitz>
apeiros, sorry. Coffee still kicking in. I'm taking text files and combining them into a book. Variables include the book's file name, the scene file names, directory names, etc.
<apeiros>
that sounds like a complex task and so naturally will have a couple of classes
<dostoyevsky>
Does anyone know a project that uses antlr for ruby? I want to see how I can access the parsed data after calling my Parser.new("string") ... documentation seems very sparse
<leitz>
Each scene gets written to a chapter file, and appended to the book.
<dminuoso>
tbuehlmann: The problem is thats not what most services ive seen model. And if they do, then stop calling it a "service" because thats just Javaism trying to make every simple concept some weird pattern.
<dminuoso>
tbuehlmann: It's kind of hilarious what dependency injection becomes in a functionally oriented setting.
<dminuoso>
It's just "arguments" :P
<apeiros>
isn't DI just a fancy term for "I want to rely on an argument instead of (potentially global) state"?
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
leitz: yes, that code certainly lends itself to have a class or two
ryzokuken has joined #ruby
schneider- has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
alex`` has quit [Ping timeout: 265 seconds]
DaveTaboola has joined #ruby
shinnya has quit [Ping timeout: 256 seconds]
schneider- has joined #ruby
sidx64 has joined #ruby
<leitz>
apeiros, such as? Remember, I'm the OOP newbie. :)
<apeiros>
the cheap thing is to start with a BookBuilder class
<dminuoso>
apeiros: Yup. Haskell aside (I just happen to come across a lot of Haskell related topics), the core inside this is very useful: https://stackoverflow.com/a/14329487
<dminuoso>
apeiros: And it largely can be applied to Ruby too. But the essential part is: Let's solve the real problem. Keep in mind that you are solving a problem, and that problem is the particular programming task at hand. Don't make your problem "implementing dependency injection".
rrutkowski has quit [Ping timeout: 248 seconds]
<apeiros>
dminuoso: I'm just continuously amazed at how people manage to even come up with whole DI frameworks
hahuang65 has joined #ruby
<dminuoso>
apeiros: +1
<apeiros>
`Don't make your problem "implementing dependency injection"` is part of a larger pattern I've noticed years ago: puzzle coders
<apeiros>
"I have this pattern, how can I fit this into my problem?"
<apeiros>
instead of "this is my problem, how do I solve this?" and then "Ah, my solution matches the description of pattern X, so I'll tell my coworkers I solved it using pattern X" (as in: use pattern for communication, not for problem identification & solving)
<leitz>
apeiros, I need to think through the class idea. I'm not against a small number of classes, if that pattern fits my problem. However, I'm not sure what problem the class(es) would solve outside passing variables.
<apeiros>
leitz: why does it have to solve more problems than "outside passing variables"?
<leitz>
apeiros, I can solve that with a hash.
<apeiros>
sounds a bit like "why would I need money, other than to buy things?"
<apeiros>
leitz: yes. in a worse way.
<apeiros>
you can also solve it by using globals.
<apeiros>
and that too is worse.
<leitz>
Classes are easy, if you understand them well. I assume, haven't gotten there yet.
<dminuoso>
apeiros: Another interesting part, is that a lot of patterns in languages emerge because of missing language tools to model some abstraction. DI is done frequently because first class support for currying functions or monads is lacking in most languages.
* leitz
even avoids globals.
<apeiros>
leitz: high time to get started then :-p
<dminuoso>
apeiros: So you try to shoehorn some ability into a language and then call it a "pattern", put it into GoF and people will mindlessly copy it.
<dminuoso>
I kind of detest GoF because of the impact the book has had
* leitz
ensures his copy of GoF isn't too visible on the shelf.
hahuang61 has joined #ruby
<apeiros>
leitz: and I think part of your problem to get used to classes is that you seem to think "but it must help me solve a complex problem!" - no, it doesn't. it's already something if it helps you solve your "I need to access this state" problem.
<dminuoso>
leitz: I personally have started to make heavy usage of lambdas and currying in Ruby.
<dminuoso>
Simply because I dont need the deep and complex meaning of objects with internal state.
<dostoyevsky>
leitz: Are you using a SingletonFactoryForestRunForest to guard the book's visibility?
<leitz>
dminuoso, I thought you didn't like lambdas?
<dminuoso>
leitz: Ruby lambdas are the cleanest first class functions.
hahuang65 has quit [Ping timeout: 268 seconds]
<dminuoso>
leitz: Its procs and blocks that have annoying semantics.
<dminuoso>
Here's why:
<leitz>
dostoyevsky, no classes at all. Yet. apeiros and dminuoso will probably convince me to change that.
<dminuoso>
>> -> e { e }[1,2]
<ruby[bot]>
dminuoso: # => wrong number of arguments (given 2, expected 1) (ArgumentError) ...check link for more (https://eval.in/967423)
adlerdias has quit [Quit: adlerdias]
RougeR has quit [Ping timeout: 240 seconds]
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang61 has quit [Ping timeout: 240 seconds]
<dminuoso>
apeiros: Swiss quality internet!
* dminuoso
grins
<apeiros>
dminuoso: no, apple being stupid. tethered via my iphone through BT. plugging the iphone via lightning caused the tethering to reconnect.
<dminuoso>
Haha
<apeiros>
I could connect through company wifi too. but private laptop requires reauthorization daily through an arduous process. and ever since I've flatrate internet on my mobile, that's just the easier way.
bigblind has joined #ruby
<apeiros>
additionally no potential corporate spying on my internet activity :-D
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sidx64 has joined #ruby
<dminuoso>
leitz: So for example everytime you hear "Builder", you can actually just write a simple lambda.
<dminuoso>
A "builder" is just something that "produces some results"
<apeiros>
dminuoso: I think you're preparing leitz for something they'll encounter in maybe 2 or 3 years
<dminuoso>
Hah
sidx64 has quit [Client Quit]
<leitz>
dminuoso, I have read most of "Mastering Ruby Closures" to get a better understanding of procs and lambas. I know more, but considering how little I knew that's not saying much.
<dminuoso>
leitz: Do you know what a method is?
bigblind has quit [Ping timeout: 256 seconds]
<leitz>
I also promised to get the book out in the next couple weeks, so major refactoring will have to wait just a bit.
<dminuoso>
leitz: Now remove "self", and conceptually you end up with a lambda.
<dminuoso>
a lambda is just a function you can call, that produces some result.
<leitz>
dminuoso, Ruby "assumes" self, correct?
<dminuoso>
leitz: well, my point is methods are tied to objects
<dminuoso>
lambdas are not
<apeiros>
leitz: any method call without an explicit receiver is sent to self, yes
<leitz>
Ah.
<apeiros>
assuming that's what you mean by "assuming self"
hahuang65 has joined #ruby
<leitz>
apeiros, yes. Like Python's self being explicit, I believe.
<dminuoso>
leitz: Consider this: `m = -> e { puts e }` and `def m e; puts e; end`
<dminuoso>
leitz: They kind of look the same right?
<dminuoso>
neither is tied to some internal objects state
<leitz>
Sorry if i seem like the dense kid in the back of the class. I'm actually the dense old guy in the front trying to re-learn.
<leitz>
That's part of what I didn't see before reading the book; why not use a method vice proc/lambda? Still letting that sink in and looking for use cases.
hahuang65 has quit [Ping timeout: 240 seconds]
<dminuoso>
leitz: consider the opposite rather. why use a method?
<dminuoso>
leitz: iow: what makes a method different from my `func` and `add`
<leitz>
dminuoso, the familiarity of "def" and her cousins in other languages.
<leitz>
Sort of like match and ~
<dminuoso>
leitz: Methods have to reside in classes (always), which means they are tied to objects of that class. If
Beams has quit [Quit: .]
<dminuoso>
So you have to have an object of that class around to invoke that method. If you want to invoke it "without a receiver", you actually make it a completely global method. There's very little in between
<dminuoso>
a lambda lets you encapsulate the idea of some computation into a small local object that you can pass around.
melodia[m] has left #ruby ["User left"]
<leitz>
dminuoso, not sure I get the "Methods have to reside in classes". I use "def ..." outside of classes in my regular code.
<apeiros>
leitz: method(:your_method).owner will tell you where those end up
Beams has joined #ruby
<dminuoso>
leitz: Even then they still end up in a class.
<dminuoso>
leitz: And you cant (trivially) pass around a method itself as a value
jenrzzz has quit [Ping timeout: 252 seconds]
<apeiros>
I'd like to challenge that :)
<dminuoso>
apeiros: UnboundMethods have that problem you still need a value, and a :symbol is too lax
<apeiros>
both, Object#method and symbols are trivial
<dminuoso>
apeiros: For both you still need an object to make it meaningful
<apeiros>
yes. it's still trivial.
schneider- has quit [Read error: Connection reset by peer]
schneider- has joined #ruby
<dminuoso>
leitz: Let me phrase it differently.
<dminuoso>
leitz: Have you ever consciously used a block?
<leitz>
dminuoso, "used well", or just "used"? :P
<dminuoso>
leitz: used.
<leitz>
Then yes.
<dminuoso>
leitz: Do you see the value in blocks?
<leitz>
Usually.
alfiemax_ has quit [Remote host closed the connection]
<dminuoso>
leitz: lambdas are blocks.
<dminuoso>
(For the sake of this discussion this is close enough to the truth)
<leitz>
Still working on multiple files open in the same block, and automatic closure.
hahuang65 has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
alfiemax has joined #ruby
<dminuoso>
leitz: `-> e { ... }` and `{ |e| ... }` are two different syntaxes for the same thing.
synthroid has joined #ruby
goatish has quit [Quit: Hibernating]
<tbuehlmann>
dminuoso: I have a lot of command objects in my recent project, although they are placed in app/services, but well, that's just naming. and I find them helpful as in they are encapsulated pretty well and have a reasonable purpose. also, I don't clutter controllers and keep models free of method that do too much. so that's my take on it
<dminuoso>
leitz: and that's also the same thing as: do |e| ... end
adlerdias has joined #ruby
<dminuoso>
leitz: let me show you the use
hahuang65 has quit [Ping timeout: 240 seconds]
alfiemax has quit [Ping timeout: 260 seconds]
bmurt has joined #ruby
stairmast0r has joined #ruby
ryzokuken is now known as ryzokuken[zzz]
ryzokuken[zzz] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
leitz: Everytime you pass a block, you actually pass a *function* as an additional parameter. An anoymous function.
<dminuoso>
It has no name, but it takes arguments and returns things
<dminuoso>
It just looks a bit quirky because it doesn't look like a parameter since its not inside the () parens of the method call. But that's just the syntax being funky.
hahuang61 has quit [Ping timeout: 268 seconds]
hahuang65 has joined #ruby
armyriad has quit [Ping timeout: 256 seconds]
armyriad has joined #ruby
<leitz>
Okay, taking this slowly.
Sauvin has quit [Ping timeout: 265 seconds]
<leitz>
The first line of ex.md assuming File.open has a "block_given" set of code, correct? If no block given you can foo = File.open("foo.csv", "w"), correct?
<dminuoso>
leitz: Yup, which it does =)
<dminuoso>
leitz: But you can change this to _any_ other method that works with a block.
<dminuoso>
Array#map is particularly interesting
<dminuoso>
>> square = -> e { e * e }; puts square[4]
ldnunes has quit [Read error: Connection reset by peer]
<dminuoso>
leitz: just ignore it silently for now.
<dminuoso>
leitz: For the purpose of this discussion you can pretend its not there.
<dminuoso>
leitz: I'd argue its actually a mistake from the Ruby authors to not allow it without an ampersand.
ldnunes has joined #ruby
<leitz>
Brain locks up trying to derefence the pointer. :)
<dminuoso>
leitz: For the purpose of reasoning about this, ignore the ampersand.
howdoi has quit [Quit: Connection closed for inactivity]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
\du has joined #ruby
<\du>
Hello, I want to get a string from a key in an array of hashes, there is any built-in function for it or should I iterate over the array? all the logic will happen in a .erb template, better here: https://kopy.io/QKLGa#Aj9Kphh1UKqFKk any clue? Thanks
<dminuoso>
leitz: Is basically a function defined inline.
<leitz>
The "handler"
<dminuoso>
You just never assign it to a variable, you just pass that function along to Fileopen
<dminuoso>
leitz: Yeah.
hahuang65 has joined #ruby
<dminuoso>
\du: Just `map` to map each element to the respective URL, and then join them together.
workmad3 has quit [Ping timeout: 240 seconds]
Sauvin has joined #ruby
milardovich has joined #ruby
<leitz>
dminuoso, the handler can use variables defined in the outer scope, correct? I think that's what I understood from the book. If so then I can use that to clean up the code a bit.
ryzokuken has quit [Ping timeout: 240 seconds]
<dminuoso>
leitz: Yeah.
<dminuoso>
leitz: That part (the ability to use things from outside the function definition) is why you call it a closure.
bigblind has joined #ruby
<dminuoso>
leitz: But at the core `handler` is just a function
<dminuoso>
not unlike:
bmurt has quit [Ping timeout: 268 seconds]
<dminuoso>
square = -> e { e * e }
jenrzzz has quit [Ping timeout: 268 seconds]
cgfbee has joined #ruby
hahuang65 has quit [Ping timeout: 256 seconds]
<leitz>
Okay, I need to let this soak in and re-read that section of the book. My boss might appreciate some time on work tasks as well. :)
<leitz>
This is cool.
<\du>
dminuoso: Thanks for the tip, I will try. It is for a Chef recipe, not a ruby expert :-/
ryzokuken has joined #ruby
<dminuoso>
\du: a = {'locale' => 'en','url' => 'weben.net'}
<dminuoso>
\du: How do you get `weben.net` ?
milardovich has quit [Ping timeout: 260 seconds]
bigblind has quit [Ping timeout: 260 seconds]
<\du>
dminuoso: I use this array of hashes in other place doing a <% @domains.each do |domain| %> ... <%= domain['url'] %>..
ivan_ has joined #ruby
<\du>
but now I want to generate a regexpr to be used in one http server directive
jenrzzz has joined #ruby
jcalla has joined #ruby
k0mpa has joined #ruby
hahuang65 has joined #ruby
<dminuoso>
\du: Right. So you can use the same idea for `map` :)
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
<dminuoso>
\du: i.e. hash.map { |d| d['url'] }.join('|')
<havenwood>
brewops: This is a good channel to ask in.
<brewops>
Sounds good, here it is!
<brewops>
We are using Puma with our Rails apps and ran into a fun scenario. We pack everything together including Ruby and all Gems and deploy it as an artifact. When we restart (reload) Puma, since Ruby was packed with the release the master process holds onto old files in the last release. Any idea how we could do something more like Unicorn reloads so the master process would let go of these files?
aupadhye has quit [Quit: Leaving]
stairmast0r has quit [Quit: bye]
dionysus69 has quit [Quit: dionysus69]
<darix>
brewops: you mean the seamless restart mode from unicorn right?
<darix>
where it hands down the listen socket?
<brewops>
Yea, the unicorn reload starts new worker processes and finally the master resulting in a new master PID.
<brewops>
With Puma, the master process is not restarted/reloaded or started new so it holds on Ruby files from the old release no matter the reload/restart method
<darix>
hmm
<brewops>
The only way to get Puma to switch over to using the new Ruby contained in the newest deployed artifact is a stop/start
<darix>
readme.md mentions socket passing
<brewops>
so far as I can see
jerikl has joined #ruby
<darix>
but maybe it still holds onto the code
tvw has quit [Remote host closed the connection]
<brewops>
Yea, the workers all do the right thing and end up running the new code
<brewops>
So we didn't actually notice until we went poking around with lsof
hahuang65 has joined #ruby
<darix>
i would ask in a github issue
<brewops>
Not a bad idea, I'll give that a try
<brewops>
Was hoping I was missing something :)
jenrzzz has quit [Ping timeout: 256 seconds]
darkhanb has joined #ruby
hahuang65 has quit [Ping timeout: 265 seconds]
suhdood has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
syamaoka has quit [Ping timeout: 268 seconds]
kies has quit [Ping timeout: 265 seconds]
nowhere_man has joined #ruby
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
andikr has quit [Remote host closed the connection]
synthroid has quit [Remote host closed the connection]
synthroid has joined #ruby
hahuang65 has joined #ruby
sanscoeur has joined #ruby
synthroid has quit [Ping timeout: 260 seconds]
synthroid has joined #ruby
hahuang65 has quit [Ping timeout: 256 seconds]
karapetyan has joined #ruby
claudiuinberlin has joined #ruby
conta has joined #ruby
gnufied has quit [Quit: Leaving]
Success has joined #ruby
hahuang61 has joined #ruby
<Success>
omg i just saw the new ruby
konos5__ has quit [Quit: Connection closed for inactivity]
orbyt_ has joined #ruby
<Success>
how easy is it to compile ruby on windows from source
gnufied has joined #ruby
Beams has quit [Quit: .]
karapetyan has quit [Ping timeout: 256 seconds]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
Zaab1t has quit [Quit: Zaab1t]
Success has quit [Changing host]
Success has joined #ruby
RougeR has quit [Ping timeout: 268 seconds]
jottr has quit [Ping timeout: 268 seconds]
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
mcr1 has joined #ruby
hahuang65 has joined #ruby
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
hahuang65 has quit [Ping timeout: 240 seconds]
anisha has quit [Quit: This computer has gone to sleep]
lytol has joined #ruby
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
Zaab1t has joined #ruby
sammi`_ has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
guille-moe has quit [Ping timeout: 256 seconds]
ryzokuken13 has joined #ruby
marxarelli|afk is now known as marxarelli
hahuang65 has joined #ruby
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
sammi` has quit [Quit: Lost terminal]
goatish has quit [Quit: Hibernating]
schneider- has joined #ruby
goatish has joined #ruby
alfiemax has joined #ruby
hahuang65 has quit [Ping timeout: 248 seconds]
aufi has joined #ruby
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ta_ has joined #ruby
ryzokuken13 has quit [Ping timeout: 260 seconds]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
DLSteve_ has quit [Quit: All rise, the honorable DLSteve has left the channel.]
gizmore|2 is now known as gizmore
balo has joined #ruby
balo has quit [Client Quit]
hahuang65 has joined #ruby
Gnut has joined #ruby
balo has joined #ruby
karapetyan has joined #ruby
nfk has joined #ruby
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
<Gnut>
If I have a static class method `self.create()`, what's the best way to reference the class if I'm looking to instantiate an instance e.g. `Classname.new()`?
<Gnut>
Maybe self.new()?
SeepingN has joined #ruby
gnufied has quit [Ping timeout: 256 seconds]
SegFaultAX has joined #ruby
PaulCape_ has quit [Ping timeout: 252 seconds]
mzo has joined #ruby
PaulCapestany has joined #ruby
<apeiros>
Gnut: just new()
<apeiros>
if you insist on an explicit receiver, then self.new, yes
sameerynho has joined #ruby
discopatrick has joined #ruby
hahuang65 has quit [Ping timeout: 260 seconds]
shoogz has joined #ruby
shoogz has quit [Max SendQ exceeded]
<Gnut>
apeiros: Cool, `new()` it is
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
ramfjord has joined #ruby
shoogz has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
alfiemax has quit [Remote host closed the connection]
ryzokuken13 has joined #ruby
fribmendes has quit [Quit: Zzzz...]
ryzokuken13 has quit [Remote host closed the connection]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
aufi has quit [Remote host closed the connection]
marr has quit [Ping timeout: 265 seconds]
hahuang65 has joined #ruby
nowhereman_ has joined #ruby
nowhere_man has quit [Ping timeout: 276 seconds]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
aufi has joined #ruby
dionysus69 has joined #ruby
hahuang65 has quit [Ping timeout: 265 seconds]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
netherwolfe has quit [Read error: Connection reset by peer]
netherwolfe has joined #ruby
tomphp has joined #ruby
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
mtkd has quit []
gnufied has joined #ruby
ryzokuken has joined #ruby
mtkd has joined #ruby
eckhardt_ has joined #ruby
chouhoul_ has joined #ruby
workmad3 has quit [Ping timeout: 240 seconds]
chouhou__ has joined #ruby
eckhardt has quit [Ping timeout: 260 seconds]
jottr has joined #ruby
n0m4d1c has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoul_ has quit [Ping timeout: 240 seconds]
Success has quit [Ping timeout: 252 seconds]
brewops has quit [Quit: Page closed]
Success has joined #ruby
hahuang65 has joined #ruby
gnufied has quit [Quit: Leaving]
gnufied has joined #ruby
Sauvin has quit [Read error: Connection reset by peer]
conta has quit [Remote host closed the connection]
alfiemax has joined #ruby
suukim has quit [Quit: Konversation terminated!]
hahuang65 has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
alex`` has joined #ruby
dionysus69 has quit [Quit: dionysus69]
alfiemax has quit [Ping timeout: 240 seconds]
mcr1 has quit [Ping timeout: 255 seconds]
jottr has quit [Ping timeout: 268 seconds]
Dimik has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
roshanavand has joined #ruby
jerikl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang65 has joined #ruby
larcara has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
knight33_ has joined #ruby
leah2 has quit [Ping timeout: 265 seconds]
knight33_ has quit [Max SendQ exceeded]
mtkd has quit []
anjen has quit [Quit: anjen]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roshanavand has quit [Ping timeout: 240 seconds]
hahuang65 has quit [Ping timeout: 256 seconds]
HashNuke has quit [Read error: Connection reset by peer]
fury has quit [Read error: Connection reset by peer]
Chew has quit [Read error: Connection reset by peer]
Brak____________ has quit [Read error: Connection reset by peer]
HashNuke has joined #ruby
Brak____________ has joined #ruby
fury has joined #ruby
Chew has joined #ruby
alfiemax has joined #ruby
SeepingN has quit [Disconnected by services]
SeepingN_ has joined #ruby
claudiuinberlin has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
habs has joined #ruby
marr has joined #ruby
<habs>
hi -- i'm new to ruby, and i see some ruby code that says for example "def foo \n return @foo if defined?(@foo) \n" ... and then goes on to actually implement the function foo. what is the purpose of this statement, why have the "return if defined" line there?
cstrahan has joined #ruby
<apeiros>
habs: looks like a (bad) memoization technique
<apeiros>
i.e. the method will calculate an expensive value once, store it in @foo, and upon further calls just immediately return that value.
hahuang65 has joined #ruby
pastorinni has quit [Remote host closed the connection]
roshanavand has joined #ruby
<habs>
apeiros: ah thanks, yes after looking that up i can see it's definitely memoization. it's used by gitlab, what would be a better way of doing memoization? via a gem?
hahuang65 has quit [Ping timeout: 240 seconds]
mtkd has joined #ruby
<apeiros>
for starters, I prefer to use @_foo to indicate that the ivar is not to be used directly
<apeiros>
then, if the value can't be nil or false, simply: @_foo ||= begin; …calc…; value; end
alex`` has quit [Read error: No route to host]
<apeiros>
if the value can be nil/false, have a second variable to track the state. initialized with false. `if @foo_computed; @_foo; else; @_foo = …; end`
<apeiros>
oh, forgot to set @foo_computed = true :)
<apeiros>
if you need the whole thing in a threaded env, I'd probably resort to a gem (hoping there is one doing that correctly)
mzo has quit [Ping timeout: 256 seconds]
alfiemax has joined #ruby
leah2 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jerikl has joined #ruby
alfiemax has quit [Ping timeout: 256 seconds]
jamesaxl has quit [Quit: WeeChat 2.0.1]
DTZUZU has quit [Quit: WeeChat 1.9]
kapil___ has quit [Quit: Connection closed for inactivity]
hahuang65 has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
bmurt has joined #ruby
aufi has quit [Remote host closed the connection]
Psybur has quit [Ping timeout: 265 seconds]
adlerdias has quit [Quit: adlerdias]
hahuang65 has quit [Ping timeout: 265 seconds]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
errakeshpd has quit [Remote host closed the connection]
jerikl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
k0mpa has quit [Remote host closed the connection]
eckhardt has joined #ruby
hahuang65 has joined #ruby
jerikl has joined #ruby
alfiemax has joined #ruby
cagomez has joined #ruby
Azure|dc has joined #ruby
Azure has quit [Read error: Connection reset by peer]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
workmad3 has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
yqt has quit [Read error: Connection reset by peer]
jottr has quit [Ping timeout: 252 seconds]
alfiemax has quit [Ping timeout: 268 seconds]
jeffreylevesque has quit [Ping timeout: 240 seconds]
druonysus has joined #ruby
druonysus has joined #ruby
druonysus has quit [Changing host]
cagomez has quit [Ping timeout: 240 seconds]
DTZUZU has quit [Quit: WeeChat 1.9]
<cjohnson>
Is there any tooling or migration guides for upgrading 2.2 -> 2.4?
<cjohnson>
And is it generally necessary to also upgrade rails from 4 -> 5 when doing so?
ldnunes has quit [Quit: Leaving]
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
workmad3 has quit [Ping timeout: 240 seconds]
<darix>
cjohnson: 1. not sure you need many changes for 2.2 -> 2.4 at all 2. rails 4 is EOL if i recall correctly, or will be soon. so you want to consider upgrading.
s3nd1v0g1us has joined #ruby
<darix>
cjohnson: support for ruby 2.2 might depend on your distro. but keep in mind 2.5 is out.
Yzguy has joined #ruby
<cjohnson>
That much is beyond scope for me, I'm one guy in one dept across many depts and we are moving to 2.4
<cjohnson>
so it's up to us to make our apps run on 2.4
<cjohnson>
I'm getting at least this error after upgrading to 2.4: constant ::Fixnum is deprecated
<cjohnson>
from ActiveSupport
ryzokuken has quit [Quit: Connection closed for inactivity]
<darix>
ah yeah
n008f4g_ has joined #ruby
<darix>
but that is a warning if i recall correctly :)
Zaab1t has quit [Quit: Zaab1t]
fribmendes has quit [Quit: Zzzz...]
<cjohnson>
Hrm, it says it's a warning, but that's the error given in this stacktrace around why passenger isn't starting
<cjohnson>
So, a little confusing
<darix>
cjohnson: well on which rails 4 version are you?
<cjohnson>
4.2.0
dmitriy_ has joined #ruby
dmitriy_ has quit [Read error: Connection reset by peer]
<cjohnson>
We are tasked to upgrade apps to work on ruby 2.4, and if necessary, also upgrade to rails 5, but if it's a massive effort (20 apps or so), we may have to break it into chunks, unless upgrading ruby requires upgrading rails