havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview1: https://www.ruby-lang.org || Paste 4+ lines of text to https://gist.github.com || Rails questions? Ask in #RubyOnRails || Books: https://goo.gl/wpGhoQ || Logs: https://irclog.whitequark.org/ruby
ElFerna has joined #ruby
<hays> whats a good way to deploy a rails app
<hays> without having to worry to much about gems/etc
alfiemax has joined #ruby
<mr-robert> heroku?
\void has quit [Quit: So long, and thanks for all the fish.]
erlend has quit [Ping timeout: 248 seconds]
erlend has joined #ruby
alfiemax has quit [Ping timeout: 264 seconds]
nowhereman_ has joined #ruby
rshetty has joined #ruby
Fysicus has quit [Excess Flood]
Fysicus has joined #ruby
rshetty has quit [Ping timeout: 248 seconds]
imode1 has joined #ruby
ElFerna has quit [Quit: Textual IRC Client: www.textualapp.com]
hays has quit [Remote host closed the connection]
harry_ has joined #ruby
Zaab1t has quit [Quit: Zaab1t]
mostlybadfly has quit [Quit: Connection closed for inactivity]
rshetty has joined #ruby
marr has quit [Ping timeout: 264 seconds]
Fysicus has quit [Excess Flood]
Fysicus has joined #ruby
rshetty has quit [Ping timeout: 260 seconds]
armyriad has quit [Quit: Leaving]
rshetty has joined #ruby
rshetty has quit [Remote host closed the connection]
rshetty has joined #ruby
John_Ivan has quit [Read error: Connection reset by peer]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rshetty has quit [Remote host closed the connection]
rshetty has joined #ruby
Fysicus has quit [Excess Flood]
Fysicus has joined #ruby
Fysicus has quit [Excess Flood]
ecuanaso has joined #ruby
Fysicus has joined #ruby
rshetty has quit [Ping timeout: 248 seconds]
rshetty has joined #ruby
jane_booty_doe has quit [Quit: Leaving]
Jahhein has joined #ruby
rf` has joined #ruby
envex has quit [Ping timeout: 240 seconds]
rf` has quit [Client Quit]
hays has joined #ruby
hays has joined #ruby
hays has quit [Changing host]
envex has joined #ruby
rshetty has quit [Ping timeout: 264 seconds]
armyriad has joined #ruby
armyriad has quit [Remote host closed the connection]
armyriad has joined #ruby
gizmore|2 has joined #ruby
amar has joined #ruby
gizmore has quit [Ping timeout: 264 seconds]
fhmax has joined #ruby
amar has quit [Ping timeout: 248 seconds]
dinfuehr has quit [Ping timeout: 240 seconds]
ta__ has quit [Remote host closed the connection]
dinfuehr has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ecuanaso has joined #ruby
envex has quit [Remote host closed the connection]
rshetty has joined #ruby
envex has joined #ruby
rshetty has quit [Ping timeout: 264 seconds]
Bozo_the_Clown has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jyaworski has joined #ruby
facest has quit [Ping timeout: 264 seconds]
ta_ has joined #ruby
fhmax has quit [Ping timeout: 240 seconds]
jaequery has joined #ruby
rshetty has joined #ruby
ta_ has quit [Ping timeout: 248 seconds]
rshetty has quit [Ping timeout: 264 seconds]
Psybur has quit [Remote host closed the connection]
ta_ has joined #ruby
schneider has joined #ruby
harrycs has joined #ruby
harry_ has quit [Ping timeout: 248 seconds]
jyaworski has quit [Ping timeout: 268 seconds]
harrycs has quit [Ping timeout: 256 seconds]
phaul has quit [Ping timeout: 260 seconds]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
agent_white has joined #ruby
cschneid has quit [Remote host closed the connection]
cschneid has joined #ruby
rshetty has joined #ruby
rshetty has quit [Ping timeout: 248 seconds]
erlend has quit [Ping timeout: 276 seconds]
erlend has joined #ruby
phenom has quit [Ping timeout: 264 seconds]
noobineer has joined #ruby
x0f has quit [Ping timeout: 268 seconds]
x0f has joined #ruby
ta_ has quit [Ping timeout: 256 seconds]
phenom has joined #ruby
Dimik has quit [Ping timeout: 255 seconds]
hays has quit [Remote host closed the connection]
ta_ has joined #ruby
apparition has joined #ruby
rshetty has joined #ruby
jaequery has joined #ruby
hays has joined #ruby
coderphive has quit [Ping timeout: 256 seconds]
schneider has quit [Ping timeout: 260 seconds]
rshetty has quit [Ping timeout: 264 seconds]
Guest1156 has quit [Quit: switching servers]
FrankD has joined #ruby
hays has quit [Read error: Connection reset by peer]
hays has joined #ruby
hays has quit [Changing host]
hays has joined #ruby
phenom has quit [Ping timeout: 248 seconds]
phenom has joined #ruby
cyberg has quit [Remote host closed the connection]
hays has quit [Remote host closed the connection]
jyaworski has joined #ruby
sspreitz has quit [Ping timeout: 256 seconds]
noobineer has quit [Remote host closed the connection]
Cyrus1 has joined #ruby
sspreitz has joined #ruby
noobineer has joined #ruby
rshetty has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
TheBloke has quit [Read error: Connection reset by peer]
sepp2k1 has quit [Read error: Connection reset by peer]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TheBloke has joined #ruby
jaequery has joined #ruby
Jahhein has quit [Max SendQ exceeded]
rshetty has quit [Ping timeout: 256 seconds]
ta_ has quit [Ping timeout: 248 seconds]
phenom has quit [Ping timeout: 268 seconds]
yxhuvud has joined #ruby
ta_ has joined #ruby
jyaworski has joined #ruby
phenom has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
hays has joined #ruby
hays has quit [Changing host]
hays has joined #ruby
dr3w_ has joined #ruby
AJA4350 has quit [Quit: AJA4350]
cschneid has quit [Remote host closed the connection]
govg has quit [Ping timeout: 255 seconds]
jyaworski has quit [Ping timeout: 248 seconds]
cschneid has joined #ruby
ogres has joined #ruby
govg has joined #ruby
govg has quit [Ping timeout: 248 seconds]
coderphive has joined #ruby
rshetty has joined #ruby
govg has joined #ruby
ta_ has quit [Ping timeout: 260 seconds]
RougeR has quit [Ping timeout: 260 seconds]
jnollette has joined #ruby
dviola has quit [Quit: WeeChat 2.1]
govg has quit [Ping timeout: 240 seconds]
noobineer has quit [Remote host closed the connection]
rshetty has quit [Ping timeout: 240 seconds]
ta_ has joined #ruby
gnotc has joined #ruby
rshetty has joined #ruby
rshetty has quit [Remote host closed the connection]
claw has quit [Ping timeout: 256 seconds]
rshetty has joined #ruby
claw has joined #ruby
gnotc has left #ruby [#ruby]
mrBen2k2k2k_ has quit [Read error: Connection reset by peer]
mrBen2k2k2k has quit [Read error: Connection reset by peer]
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
yxhuvud has joined #ruby
pd2000 has joined #ruby
pd2000 has quit [Max SendQ exceeded]
faces has joined #ruby
jcarl43 has joined #ruby
faces has quit [Client Quit]
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
trautwein has joined #ruby
face has joined #ruby
erlend has quit [Ping timeout: 276 seconds]
yxhuvud has joined #ruby
erlend has joined #ruby
def_jam is now known as eb0t
ta_ has quit [Ping timeout: 256 seconds]
alfiemax has joined #ruby
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
ta_ has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
cschneid has quit [Remote host closed the connection]
yxhuvud has joined #ruby
cschneid has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shinnya has joined #ruby
hays has quit [Remote host closed the connection]
pd2000 has joined #ruby
jaequery has joined #ruby
cschneid has quit [Remote host closed the connection]
rshetty has quit [Remote host closed the connection]
cschneid has joined #ruby
cschneid has quit [Remote host closed the connection]
cschneid has joined #ruby
byte512 has quit [Ping timeout: 248 seconds]
ta_ has quit [Ping timeout: 264 seconds]
p_d has joined #ruby
rshetty has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
byte512 has joined #ruby
p_d has quit [Max SendQ exceeded]
apparition has quit [Quit: Bye]
p_d has joined #ruby
cschneid has quit [Remote host closed the connection]
p_d has quit [Max SendQ exceeded]
pd2000 has quit [Ping timeout: 268 seconds]
AkyRhO has quit [Ping timeout: 276 seconds]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
ptx0 has quit [Ping timeout: 256 seconds]
rshetty has quit [Ping timeout: 256 seconds]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
ta_ has joined #ruby
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
p_d has joined #ruby
p_d has quit [Max SendQ exceeded]
alex`` has quit [Quit: WeeChat 2.1]
amar has joined #ruby
nadir has quit [Quit: Oh fer fuck's sake]
jyaworski has joined #ruby
amar has quit [Ping timeout: 264 seconds]
jamesaxl has joined #ruby
copyto has joined #ruby
baweaver_away is now known as baweaver
baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview1: https://www.ruby-lang.org || Paste 4+ lines of text to https://gist.github.com || Rails questions? Ask in #RubyOnRails || Books: https://goo.gl/wpGhoQ || Logs: https://irclog.whitequark.org/ruby || Can't talk? Register/identify with Nickserv first!
ta_ has quit [Ping timeout: 260 seconds]
copyto has quit [Quit: copyto]
rshetty has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
rshetty has quit [Ping timeout: 248 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jyaworski has quit [Ping timeout: 256 seconds]
orbyt_ has joined #ruby
Jahhein has joined #ruby
Mike11 has joined #ruby
rshetty has joined #ruby
solocshaw has quit [Ping timeout: 260 seconds]
rshetty has quit [Ping timeout: 268 seconds]
solocshaw has joined #ruby
apparition has joined #ruby
Haris has joined #ruby
<Haris> I'm installing bundle. it gives error when it reaches pg. pg installs header files at custom folder (i.e., /usr/pgsql-9.4/include/ ). How to soft link them under /usr/include or make them available for bundle to get installed normally ?
<Haris> I'v tried softlinking the folder /usr/pgsql-9.4/include/ to /usr/include/pgsql-9.4, but it doesn't work. bundle can't find pg's headers to build pg. I'v tried soft-linking single files, but reached an error, where it seemed soft linking the folder would be the only way it would work
ptx0 has joined #ruby
<Haris> I'm at an impass. How do I make it work ?
Haris has quit [Ping timeout: 256 seconds]
hndk has quit [Quit: Leaving]
TvL2386 has quit [Ping timeout: 260 seconds]
TvL2386 has joined #ruby
minimalism has quit [Quit: minimalism]
coderphive has quit [Quit: coderphive]
Haris has joined #ruby
Jahhein has quit [Quit: Textual IRC Client: www.textualapp.com]
ldepandis has joined #ruby
conta has joined #ruby
solocshaw has quit [Ping timeout: 260 seconds]
ogres has quit [Quit: Connection closed for inactivity]
conta has quit [Ping timeout: 268 seconds]
rippa has joined #ruby
Puffball has quit [Remote host closed the connection]
Mike11 has quit [Quit: Leaving.]
_aeris_ has quit [Ping timeout: 256 seconds]
_aeris_ has joined #ruby
ledestin has joined #ruby
kapil___ has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
marr has joined #ruby
tomphp has joined #ruby
Sauvin has quit [Ping timeout: 260 seconds]
jcarl43 has quit [Quit: WeeChat 2.1]
mniip has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
Sauvin has joined #ruby
apparition has quit [Quit: Bye]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Haris> guys ?
conta has joined #ruby
<Haris> I'm installing the ruby gem for pg. It can't locate the files installed by pg from pg's yum for 9.4.17
conta has quit [Ping timeout: 260 seconds]
schneider has joined #ruby
blackmesa has quit [Ping timeout: 256 seconds]
Bozo_the_Clown has quit [Remote host closed the connection]
Mia has quit [Ping timeout: 260 seconds]
imode1 has quit [Ping timeout: 264 seconds]
shenghi has quit [Ping timeout: 240 seconds]
shenghi has joined #ruby
CrazyEddy has quit [Ping timeout: 260 seconds]
CrazyEddy has joined #ruby
blackmesa has joined #ruby
blackmesa has quit [Ping timeout: 255 seconds]
alfiemax has joined #ruby
erlend has quit [Ping timeout: 268 seconds]
erlend has joined #ruby
nowhereman_ has quit [Ping timeout: 264 seconds]
p0s1x has joined #ruby
rshetty has joined #ruby
rshetty has quit [Remote host closed the connection]
rshetty has joined #ruby
Haris has left #ruby [#ruby]
p0s1x has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has quit [Remote host closed the connection]
imode1 has joined #ruby
alfiemax has joined #ruby
alfiemax has quit [Remote host closed the connection]
p0s1x has joined #ruby
face has quit [Disconnected by services]
rshetty has quit [Remote host closed the connection]
p0s1x has quit [Client Quit]
alfiemax has joined #ruby
conta has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
conta has quit [Ping timeout: 260 seconds]
p0s1x has joined #ruby
rshetty has joined #ruby
apeiros has quit [Read error: Connection reset by peer]
apeiros has joined #ruby
p0s1x has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kiltzman has quit [Ping timeout: 252 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rshetty has quit [Ping timeout: 255 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has joined #ruby
apparition has joined #ruby
schneider has quit [Ping timeout: 256 seconds]
alfiemax has joined #ruby
alfiemax has quit [Remote host closed the connection]
conta has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
schneider has joined #ruby
zenspider has quit [Quit: bye]
conta has quit [Ping timeout: 248 seconds]
atchoum has joined #ruby
<atchoum> hello
<atchoum> I have trouble when using unit tests.
<atchoum> If I `require` a file with unit test in it, the test is ran each time I require this file.
schneider has quit [Ping timeout: 256 seconds]
<atchoum> So the same test is rerun 3 or 4 itmes.
<atchoum> How can I have unit tests running if I only run this file main.rb ?
<atchoum> not when I `require` it ?
<atchoum> A possible solution would be to have specialized import, like loading only a module from a given ruby file.
<atchoum> any idea ?
p0s1x has joined #ruby
ncopa2 has quit [Remote host closed the connection]
rshetty has joined #ruby
leitz has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
p0s1x has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rshetty has quit [Ping timeout: 264 seconds]
imode1 has quit [Ping timeout: 240 seconds]
tomphp has joined #ruby
physicist__ has quit [Quit: leaving]
<leitz> If I want an acceptance test suite that lets me run a program from the command line and then the suite evaluates the output, RSpec? Cucumber? Other?
jottr_ has joined #ruby
<leitz> I'm already planning to learn more rspec.
<atchoum> I don't get why ruby has such kind of a `primitive` builtin import models
<atchoum> I mean, it seems very hard to define namespace,
physicist__ has joined #ruby
p0s1x has joined #ruby
<atchoum> can you have multiple inheritance in ruby by another mean than just using mixins ?
<leitz> Not directly, as in Python. However, you can have child classes of other child classes. And mixins are pretty powerful.
kapil___ has joined #ruby
rshetty has joined #ruby
<leitz> atchoum, I'm not a great Ruby programmer, just answering until the smart people wake up. )
<leitz> Modules mixed in, seem to provide a decent namespace.
<atchoum> yes
<atchoum> that's what i am doing right now, it seems you can actually structure your code in a convenient way
<atchoum> Module stuff is a powerful abstraction
<atchoum> I am too used to the python rigid type system so ...
<atchoum> I need to try to continue to practice
rshetty has quit [Ping timeout: 260 seconds]
erlend has quit [Ping timeout: 260 seconds]
<leitz> atchoum, when you say "I need to try to continue to practice" you are really saying "I will not stop learning." That is a great way to get great.
mjolnird has joined #ruby
<leitz> Ruby and Python are different. Both are pretty good.
erlend has joined #ruby
dionysus69 has joined #ruby
dr3w_ has joined #ruby
<atchoum> I have trouble with do blocks associated with iterators
<atchoum> I assumed that since everything is an expression in ruby, you can do something like ((1..10).each do |x| x*2 end).sum
<atchoum> it would be then (2..20).sum but is actually (1..10). If I try to use map, then it works. Should I use map really ?
AJA4350 has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros> atchoum: obj.each always returns obj
<apeiros> atchoum: you want .map instead
<apeiros> also if you want to chain, use {} instead of do/end, it's much nicer to read
<apeiros> >> (1..10).map { |x| x*2 }.sum
<ruby[bot]> apeiros: # => undefined method `sum' for [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]:Array (NoMethodError) ...check link for more (https://eval.in/981879)
<apeiros> meh, too old ruby :(
<apeiros> >> (1..10).map { |x| x*2 }.inject :+
<ruby[bot]> apeiros: # => 110 (https://eval.in/981880)
<leitz> atchoum, apeiros is one of those smart people I was talking about. :)
amelliaa has joined #ruby
riotjones has joined #ruby
riotjones has quit [Client Quit]
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
trautwein has joined #ruby
biberu has joined #ruby
venmx has joined #ruby
trautwein has quit [Client Quit]
trautwein has joined #ruby
trautwein has quit [Client Quit]
mjolnird has quit [Remote host closed the connection]
trautwein has joined #ruby
trautwein has quit [Client Quit]
Erlingur has joined #ruby
trautwein has joined #ruby
<atchoum> say you have a @instance_variable and an `instance` object. How do you get the value of @instance_variable from the `instance` object ?
postmodern has quit [Quit: Leaving]
<apeiros> access to instance variables from "outside" is only possible via methods
<apeiros> so either you provide an explicit reader (e.g. via attr_reader :name), or you use Object#instance_variable_get
<apeiros> the latter is meant mostly for debugging/development, and in rare cases of metaprogramming
<atchoum> okay
<atchoum> thanks
<leitz> apeiros, any opinion on the rspec/cucumber/other mental debate?
<atchoum> I had written a special method but attr_reader seems fine
<apeiros> hm? I don't like rspec and prefer minitest. I think cucumber is a great idea but IMO & IME is only worth the effort in rather large companies. no idea about "other mental debate".
p0s1x has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leitz> apeiros, my CLI based character generator gives a few lines to STDOUT. I'm reading "Growing Object Oriented Software, Guided By Tests" and it pointed out the value of acceptance testing. That's what I'm looking to do.
<leitz> Also to learn more rspec, but not sure if that's the right tool for this particuler task.
<apeiros> leitz: huh? acceptance testing is not an automated task.
<apeiros> unit & integration tests are
<apeiros> acceptance testing is whether the users of the software "accept" the changes
<apeiros> at least that's how I learnt it 🤔
marr has quit [Ping timeout: 248 seconds]
<apeiros> oh, looking at the WP article, it seems there's a lingual difference. seems in english what I mean is specified in more detail as "user acceptance test" (in german we call it just "acceptance test")
<apeiros> in that case - not quite sure where the differentiation of non-user acceptance testing and unit/integration tests is
p0s1x has joined #ruby
<atchoum> do you have any idea of a where binding similar to Haskell `where` in ruby ?
<leitz> unit testing is each class, integration is connections between layers (code connect to database), and acceptance is "Does the output look like it should".
<leitz> That's the definition list i have so far.
<apeiros> atchoum: I don't know haskell, so without an explanation, not really, no
<leitz> In my case, I need to verify that 2-8 lines of output are in the right order, format, and nothing blows up.
<leitz> Since I'm still learning to code, things blow up a lot. :)
<atchoum> basically the idea is to have an expression with a binding definition just below the expression
<atchoum> instead of above
<atchoum> `let y=3 + x where x = 2`
<atchoum> defines y = 5
dr3w_ has joined #ruby
<atchoum> that would be useful but I can also store the result in a variable above my block of code
<atchoum> the effect would be the same though less elegant perhaps.
<apeiros> what's the difference to just `y = 3 + x`?
<atchoum> not that much.
<atchoum> do you know how one can access ancestor methods in a class ?
<apeiros> super
<atchoum> ok
<apeiros> class A < B; def foo; super; end; end # super will call foo in B, if B doesn't define it, then in B's superclass etc.
<apeiros> note that super has some rather special syntax rules:
<apeiros> `super`: invoke the inherited method with all parameters passed to the current method, also keeping all changes via assignment
<apeiros> `super()` invoke the inherited method without arguments, but will still pass on a block if one was given
<apeiros> `super(&nil)` also suppresses a passed block
<al2o3-cr> apeiros: TIL never new about super(&nil)
<apeiros> yeah, that one cost me half an hour of my life I'll never get back 😅
<al2o3-cr> ;)
<al2o3-cr> *knew
<atchoum> hashmap are mutable objects right ? So if do map on a list of dict, you are actually mutating all the objects in place, and so the original list is also modified, right ?
<apeiros> mutating objects stored in the hashmap and mutating the hashmap itself are two different things
<apeiros> but yes, if you mutate an object, it is visible everywhere it is referenced
rshetty has joined #ruby
<atchoum> is there a possibility for dict comprehension in ruby ?
<apeiros> if dict-comprehension is similar as list-comprehension - all those things work via methods in ruby
<atchoum> myDict.map |x, y| {x=>y}
<atchoum> something like that
<apeiros> that works almost like that
<atchoum> but I don't know the proper syntax. yeah, so there must be a convenient method to do this, but it is not map I guess.
<apeiros> new_hash = hash.map { |key, value| …; [new_key, new_value] }.to_h
venmx has quit [Remote host closed the connection]
<apeiros> where … is code where you do something with key & value and assign the new key and new value to new_key and new_value
<atchoum> ok
<apeiros> also with newer rubies there's Hash#transform_keys and #transform_values
<apeiros> sadly no #transform for both, keys & values at the same time
rshetty has quit [Ping timeout: 248 seconds]
roshanavand has joined #ruby
dcluna has quit [Ping timeout: 240 seconds]
rshetty has joined #ruby
roshanavand has quit [Ping timeout: 240 seconds]
ruurd has joined #ruby
jottr_ has quit [Ping timeout: 260 seconds]
p0s1x has quit [Read error: Connection reset by peer]
leitz has quit [Quit: Nappy time]
Erlingur has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dr3w_ has joined #ruby
amelliaa has quit [Quit: -]
trautwein has quit [Ping timeout: 264 seconds]
trautwein has joined #ruby
rshetty has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 268 seconds]
<atchoum> ok
<atchoum> can you tell me how you would do to unset a method from a mixed in module ?
<apeiros> I wouldn't
<apeiros> but there's the undef keyword, and Module#undef_method and #remove_method
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<chridal> I have a class that in turn uses RestClient::Resource.new and eventually does a .get on it. I would like to test this, with RSpec for instance. It is easy to test it, if I were to use expect_any_instance_of(RestClient::Resource).to receive(:get), but it is considered bad practice to use any_instance_of.
<chridal> How can I test this instead? I need to stub out that call.
jottr_ has joined #ruby
cschneid has joined #ruby
erlend has quit [Ping timeout: 255 seconds]
jottr_ has quit [Ping timeout: 256 seconds]
dr3w_ has joined #ruby
leah2 has quit [Ping timeout: 276 seconds]
erlend has joined #ruby
apeiros has quit [Read error: Connection reset by peer]
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
trautwein has joined #ruby
leah2 has joined #ruby
jottr_ has joined #ruby
apeiros has joined #ruby
<atchoum> How would you do if you have a list of records [{'id'=>foo, 'field1'=> value1, 'field2'=> value2}] to transform it into a hashmap with {foo=>{'field1'=> value1, 'field2'=>value2}, bar=>, etc.} ?
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
<pabs> list.reduce({}) { |r, row| id = row.delete('id'); r[ODODODODODODODODODid] = row; r }
<pabs> err
<pabs> list.reduce({}) { |r, row| id = row.delete('id'); r[id] = row; r }
<pabs> sorry about that
<apeiros> pabs: each_with_object >>> inject with an artificial last statement
<apeiros> (or reduce)
kapil___ has quit [Quit: Connection closed for inactivity]
<pabs> atchoum: if you want to keep the id in the row you can ditch the delete and do it like this: list.reduce({}) { |r, row| r[row['id']] = row; r }
trautwein has joined #ruby
<atchoum> ok, reduce is cool
<atchoum> ruby is very functional
<apeiros> list.each_with_object({}) { |row, hash| hash[row["id"]] = row } # as said, no artificial "; r" required
<atchoum> you can update hashmap in place with that, isn't it ?
<apeiros> yes
<apeiros> or whichever object you use
al2o3-cr has quit [Ping timeout: 240 seconds]
<apeiros> the argument you pass to each_with_object is yielded on every iteration. it's suitable for accumulators which you want to mutate.
<apeiros> inject/reduce is for when you're working with results of operations
<apeiros> (return values)
dionysus69 has quit [Quit: dionysus69]
ruurd has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
gr33n7007h is now known as al2o3-cr
jottr_ has quit [Ping timeout: 256 seconds]
elementaru has joined #ruby
zapata has quit [Quit: WeeChat 2.1]
konsolebox has quit [Max SendQ exceeded]
sagax has quit [Read error: Connection reset by peer]
zapata has joined #ruby
rshetty has joined #ruby
rshetty has quit [Ping timeout: 240 seconds]
jottr_ has joined #ruby
physicist__ has quit [Read error: Connection reset by peer]
Dimik has joined #ruby
physicist__ has joined #ruby
jottr_ has quit [Ping timeout: 256 seconds]
VVelox has joined #ruby
schneider has joined #ruby
<VVelox> For Net::LDAP, how do I disable encryption?
jottr_ has joined #ruby
<VVelox> looks like setting the method to simple should work, but it is erroring.... although I think this may be a Mastodon bug
<atchoum> what is the ruby equivalent of the `in` operator in python ?
<atchoum> 1 in [3,2,1]
<atchoum> would be true
<atchoum> 4 in [3,2,1] would be false, but how do you do that in ruby ?
<atchoum> got it it would be include
<al2o3-cr> atchoum: [1,2,3].member? 1
<al2o3-cr> or include? indeed
VVelox has left #ruby [#ruby]
<al2o3-cr> Array#include? Enumerable#member? Range#cover? Comparable#between? are your friends :)
\void has joined #ruby
Erlingur has joined #ruby
Erlingur has quit [Client Quit]
alfiemax has joined #ruby
oleo2 has joined #ruby
jottr_ has quit [Ping timeout: 256 seconds]
alfiemax has quit [Ping timeout: 255 seconds]
oleo2__ has joined #ruby
noobineer has joined #ruby
oleo2 has quit [Ping timeout: 276 seconds]
apparition has quit [Quit: Bye]
oleo2__ has quit [Remote host closed the connection]
yokel has quit [Remote host closed the connection]
noobineer has quit [Ping timeout: 256 seconds]
yokel has joined #ruby
jottr_ has joined #ruby
donofrio has quit [Remote host closed the connection]
alfiemax has joined #ruby
chalupajack has joined #ruby
jottr_ has quit [Ping timeout: 264 seconds]
venmx has joined #ruby
erlend has quit [Ping timeout: 264 seconds]
erlend has joined #ruby
jottr_ has joined #ruby
chalupajack has quit [Ping timeout: 276 seconds]
rshetty has joined #ruby
chalupajack has joined #ruby
chalupajack has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 240 seconds]
schneider has quit [Quit: WeeChat 2.0.1]
venmx has quit [Remote host closed the connection]
schneider has joined #ruby
venmx has joined #ruby
jottr_ has quit [Ping timeout: 256 seconds]
yeticry has quit [Ping timeout: 255 seconds]
solocshaw has joined #ruby
yeticry has joined #ruby
Olipro has quit [Ping timeout: 255 seconds]
lupine has quit [Ping timeout: 255 seconds]
alfiemax has quit [Ping timeout: 276 seconds]
AJA4350 has joined #ruby
lupine has joined #ruby
schneider has quit [Ping timeout: 268 seconds]
dstrunk has joined #ruby
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
orbyt_ has joined #ruby
Xiti has quit [Quit: Xiti]
jottr_ has joined #ruby
Xiti has joined #ruby
errakeshpd has joined #ruby
Yzguy has joined #ruby
jottr_ has quit [Ping timeout: 246 seconds]
solocshaw has quit [Ping timeout: 268 seconds]
marr has joined #ruby
errakeshpd has quit []
marr has quit [Remote host closed the connection]
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jottr_ has joined #ruby
dstrunk has joined #ruby
mr_rich101 has quit [Quit: ZNC - http://znc.in]
minimalism has joined #ruby
mr_rich101 has joined #ruby
VladGh has quit [Read error: Connection reset by peer]
venmx has quit [Remote host closed the connection]
DTZUZU has quit [Ping timeout: 268 seconds]
conta has joined #ruby
Yzguy has quit [Quit: Zzz...]
axsuul has quit [Ping timeout: 276 seconds]
solocshaw has joined #ruby
ldepandis has quit [Quit: Textual IRC Client: www.textualapp.com]
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
axsuul has joined #ruby
coderphive has joined #ruby
cagomez has joined #ruby
dstrunk has joined #ruby
KeyJoo has joined #ruby
solocshaw has quit [Ping timeout: 276 seconds]
cagomez has quit [Remote host closed the connection]
ledestin has joined #ruby
cagomez has joined #ruby
leah2 has quit [Ping timeout: 246 seconds]
leah2 has joined #ruby
jottr_ has quit [Ping timeout: 264 seconds]
Erlingur has joined #ruby
dionysus69 has joined #ruby
Erlingur has quit [Client Quit]
cschneid has quit [Ping timeout: 240 seconds]
noobineer has joined #ruby
za1b1tsu has joined #ruby
dionysus69 has quit [Quit: dionysus69]
za1b1tsu has quit [Remote host closed the connection]
cagomez has quit [Remote host closed the connection]
conta has quit [Ping timeout: 264 seconds]
cagomez has joined #ruby
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
DTZUZU has joined #ruby
nadir has joined #ruby
dstrunk has joined #ruby
cagomez has quit [Remote host closed the connection]
Ltem has joined #ruby
jottr_ has joined #ruby
kapil___ has joined #ruby
jottr_ has quit [Ping timeout: 255 seconds]
erlend has quit [Ping timeout: 264 seconds]
erlend has joined #ruby
jottr_ has joined #ruby
sanscoeu_ has quit [Ping timeout: 256 seconds]
cagomez has joined #ruby
sanscoeur has joined #ruby
duderonomy has joined #ruby
cagomez has quit [Remote host closed the connection]
sammi` has quit [Quit: Lost terminal]
noobineer has quit [Ping timeout: 248 seconds]
solocshaw has joined #ruby
venmx has joined #ruby
donofrio has joined #ruby
venmx has quit [Remote host closed the connection]
noobineer has joined #ruby
dr3w_ has joined #ruby
cagomez has joined #ruby
tomphp has joined #ruby
wolfshappen has quit [Quit: Waffs have technical problems too]
solocshaw has quit [Ping timeout: 264 seconds]
jottr_ has quit [Ping timeout: 240 seconds]
nicesignal has quit [Remote host closed the connection]
nicesignal has joined #ruby
solocshaw has joined #ruby
KeyJoo has quit [Remote host closed the connection]
jottr_ has joined #ruby
coderphive has quit [Quit: coderphive]
jottr_ has quit [Ping timeout: 264 seconds]
cagomez has quit [Remote host closed the connection]
X-Jester has quit [Ping timeout: 256 seconds]
jottr_ has joined #ruby
rshetty has quit [Remote host closed the connection]
rshetty has joined #ruby
Dimik has quit [Ping timeout: 256 seconds]
rshetty has quit [Ping timeout: 260 seconds]
einarj has joined #ruby
marr has joined #ruby
tdy has quit [Ping timeout: 260 seconds]
einarj has quit [Remote host closed the connection]
conta has joined #ruby
imode1 has joined #ruby
einarj has joined #ruby
za1b1tsu has joined #ruby
conta has quit [Ping timeout: 256 seconds]
jottr_ has quit [Ping timeout: 256 seconds]
einarj has quit [Ping timeout: 264 seconds]
Zaab1t has joined #ruby
einarj has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
wolfshappen has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
agent_white has quit [Quit: bai]
einarj has quit [Remote host closed the connection]
einarj has joined #ruby
erlend has quit [Ping timeout: 260 seconds]
erlend has joined #ruby
einarj has quit [Ping timeout: 240 seconds]
jottr_ has joined #ruby
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #ruby
phaul has joined #ruby
jottr_ has quit [Ping timeout: 276 seconds]
tdy has joined #ruby
jottr_ has joined #ruby
<kapil___> How to modify last index of an array?
<apeiros> kapil___: how do you modify the nth index of an array?
conta has joined #ruby
<kapil___> a = []
<kapil___> a[0]=...
<apeiros> ok, so you use Array#[]=
<apeiros> &ri Array#[]= kapil___
<apeiros> now take a look at the documentation of that method ;-)
<kapil___> Thanks
wolfshappen has quit [Quit: Waffs have technical problems too]
<kapil___> I want to modify with function
conta has quit [Ping timeout: 264 seconds]
<apeiros> I don't understand what you mean by that
segy has quit [Quit: ZNC - http://znc.in]
<kapil___> update function is not available?
<apeiros> update function for what?
<kapil___> for array value change
<apeiros> is this still for changing the last index?
<kapil___> I want to change last value of an array but no want two lines
<apeiros> o0
<apeiros> how'd you do it in two lines then?
schneider has joined #ruby
segy has joined #ruby
<kapil___> a[-1] = a[-1].pluralize
<apeiros> ok. that looks like one line to me
<kapil___> a.map{|a| a.underscore}[-1] = ????.pluralize
<apeiros> you can use tap for that
<apeiros> but IMO just use two lines
<kapil___> Ok thanks
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros> ary.map { …stuff… }.tap { |a| a[-1] = a[-1].whatever }
<kapil___> Thanks a lot
<apeiros> but again: two lines is IMO the better idea
<kapil___> Ok
<al2o3-cr> kapil___: you could do; a.fill(a.last.foo, -1)
<al2o3-cr> or use the block form of Array#fill
<kapil___> I read abut tap.
<kapil___> al2o3-cr: thanks
<al2o3-cr> np ;P
<al2o3-cr> actually block form is all elements so sack that.
wolfshappen has joined #ruby
orbyt_ has joined #ruby
schneider has quit [Ping timeout: 248 seconds]
jottr_ has quit [Ping timeout: 256 seconds]
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has joined #ruby
<kapil___> b =["ads", "Ksdfs"]
<kapil___> `b.tap{|a| a.map{|j| j.downcase}}` not working
HoierM has joined #ruby
<kapil___> it return `["ads", "Ksdfs"] `
noobineer has quit [Ping timeout: 256 seconds]
<Zarthus> i'd wager it's because j.downcase is a redundant statement not actually doing anything
<Zarthus> i would try j.downcase!, but I don't know if that's enough to get it working
<Zarthus> >> b =["ads", "Ksdfs"]; b.tap{|a| a.map{|j| j.downcase!}}
<ruby[bot]> Zarthus: # => ["ads", "ksdfs"] (https://eval.in/981953)
<apeiros> there's not really a point to use tap there
physicist__ has quit [Ping timeout: 256 seconds]
dr3w_ has joined #ruby
jottr_ has joined #ruby
<havenwood> kapil___: tap is like tapping a phone line - you don't change the conversation
<havenwood> kapil___: it seems like you're thinking yield_self, but there isn't a reason to do it, at least in the code you showed
<havenwood> >> ["ads", "Ksdfs"].map &:downcase
<ruby[bot]> havenwood: # => ["ads", "ksdfs"] (https://eval.in/981954)
noobineer has joined #ruby
ellcs has joined #ruby
<apeiros> havenwood: check backlog, I showed kapil___ tap as an option for `(large_expression_returning_array).tap { |ary| ary[-1] = … }`, i.e. to change the last item of an array which is the result of some large-ish expression.
<apeiros> just saying because I'll be mainly afk now, so you can properly take over ;-)
<havenwood> apeiros: oops, didn't see that - roger!
<havenwood> kapil___: nvm!
<kapil___> I am using rails
<apeiros> (but yes, of course, the way they apply it now makes little sense)
jottr_ has quit [Ping timeout: 264 seconds]
Yzguy has joined #ruby
<kapil___> apeiros: `(large_expression_returning_array).tap { |ary| ary[-1] = … }` works
jottr_ has joined #ruby
aaronm04 has joined #ruby
<aaronm04> Hi, is it a bad idea to do `puts` from multiple threads at the same time?
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Zarthus> aaronm04: kind of, depends on your application
<Zarthus> if the order of output doesn't matter, it doesn't really hurt
<aaronm04> the order does matter, and it's also important that I not lose any lines
<Zarthus> how do you expect the order to be correct when you have multiple threads performing actions asynchronously?
<Zarthus> you could wait for one thread to finish its action before moving on with the other thread, but then the benefit of threading is kind of lost
<aaronm04> I was assuming 1 puts = 1 write syscall (which are atomic)
dr3w__ has joined #ruby
<aaronm04> if the order gets messed up, I'm considering using a Queue to send all puts lines to a logger thread
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dr3w_ has quit [Ping timeout: 240 seconds]
<Zarthus> i don't think i fully understand, the order will be whatever completes first
<Zarthus> it's not being "messed up", but it does mean if ThreadA completes first that message will be before ThreadB
<aaronm04> that's actually what I want
<apeiros> aaronm04: puts is not atomic
<apeiros> in general, don't assume anything to be atomic which doesn't explicitly state to be
dmarcoux has joined #ruby
<aaronm04> it would be bad if puts from thread A happens before puts from thread B, but the puts A line is _after_ the puts B line
<aaronm04> apeiros: ok, thanks
<Zarthus> there is no order though, sometimes ThreadB might finish faster and then that message is first
<aaronm04> that would be ok
<aaronm04> my main concerns are 1) puts lines being lost, and 2) puts lines out of order from when the puts are actually executed
Deesl has joined #ruby
za1b1tsu has quit [Ping timeout: 256 seconds]
<Zarthus> i've never actually seen (2) happen ever in the years i've been programming, i'd wonder what language would do that
<aaronm04> hmm, alright
jottr_ has quit [Ping timeout: 264 seconds]
z3uS is now known as z3uS-
z3uS- is now known as z3uS
z3uS has quit [Quit: /dev/null]
z3uS has joined #ruby
HoierM has quit [Ping timeout: 268 seconds]
Deesl has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Deesl has joined #ruby
trautwein has joined #ruby
roshanavand has joined #ruby
biberu has quit []
coderphive has joined #ruby
alfiemax has joined #ruby
dionysus69 has joined #ruby
z3uS has quit [Quit: /dev/null]
Deesl has quit [Quit: Textual IRC Client: www.textualapp.com]
z3uS has joined #ruby
erlend has quit [Ping timeout: 248 seconds]
Zaab1t has quit [Quit: Zaab1t]
erlend has joined #ruby
baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview1: https://www.ruby-lang.org || Paste 4+ lines of text to https://gist.github.com || Rails questions? Ask in #RubyOnRails || Books: https://goo.gl/wpGhoQ || Logs: https://irclog.whitequark.org/ruby
alfiemax has quit [Ping timeout: 240 seconds]
dionysus69 has quit [Ping timeout: 264 seconds]
phenom has quit [Ping timeout: 264 seconds]
arhide has joined #ruby
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
phenom has joined #ruby
alfiemax has joined #ruby
jaequery has joined #ruby
alfiemax has quit [Ping timeout: 264 seconds]
roshanavand has quit [Ping timeout: 240 seconds]
trautwein has joined #ruby
dstrunk has joined #ruby
cschneid has joined #ruby
John_Ivan has joined #ruby
John_Ivan has joined #ruby
John_Ivan has quit [Changing host]
cschneid has quit [Remote host closed the connection]
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
alfiemax has joined #ruby
trautwein has joined #ruby
alfiemax has quit [Ping timeout: 268 seconds]
iszak has quit [Ping timeout: 248 seconds]
trautwein has quit [Remote host closed the connection]
iszak has joined #ruby
iszak has quit [Changing host]
iszak has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jamesaxl has quit [Read error: Connection reset by peer]
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
jamesaxl has joined #ruby
arhide has quit [Remote host closed the connection]
trautwein has joined #ruby
clemens3 has quit [Ping timeout: 268 seconds]
atchoum has quit [Ping timeout: 276 seconds]
za1b1tsu has joined #ruby
dr3w_ has joined #ruby
alfiemax has joined #ruby
dr3w__ has quit [Ping timeout: 255 seconds]
alfiemax has quit [Ping timeout: 264 seconds]
Ltem has quit [Quit: Leaving]
hndk has joined #ruby
Puffball has joined #ruby
Fysicus has quit [Excess Flood]
Fysicus has joined #ruby
karapetyan has joined #ruby
shinnya has joined #ruby
ellcs has quit [Ping timeout: 240 seconds]
ta__ has joined #ruby
duderono_ has joined #ruby
duderonomy has quit [Ping timeout: 248 seconds]
za1b1tsu has quit [Quit: Leaving]
duderono_ has quit [Ping timeout: 268 seconds]
cschneid has joined #ruby
ecuanaso has joined #ruby
jaequery has joined #ruby
hndk has quit [Quit: Leaving]
cschneid has quit [Ping timeout: 264 seconds]
jaequery has quit [Ping timeout: 255 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
cschneid has joined #ruby
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid has quit [Ping timeout: 248 seconds]
nadir has quit [Quit: Connection closed for inactivity]
cschneid has joined #ruby
cschneid has quit [Remote host closed the connection]
erlend has quit [Ping timeout: 276 seconds]
erlend has joined #ruby
_whitelogger has joined #ruby
John_Ivan has quit [Read error: Connection reset by peer]
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]