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-preview2: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
g- has quit [Read error: Connection reset by peer]
jcarl43 has quit [Quit: WeeChat 2.2]
brandoncc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
safetypin has quit [Quit: ZZZzzz…]
safetypin has joined #ruby
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
cyberRodent has quit [Ping timeout: 252 seconds]
cagomez has quit [Ping timeout: 264 seconds]
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
TheBloke- has joined #ruby
TheBloke has quit [Ping timeout: 272 seconds]
RougeR has quit [Ping timeout: 245 seconds]
DTZUZO has quit [Ping timeout: 252 seconds]
cyberRodent has joined #ruby
RougeR has joined #ruby
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
ShekharReddy has quit [Quit: Connection closed for inactivity]
safetypin has quit [Quit: ZZZzzz…]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
mwlang has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
knight33 has quit [Quit: Textual IRC Client: www.textualapp.com]
ss_much has joined #ruby
_whitelogger has joined #ruby
akem__ has joined #ruby
lxsameer has joined #ruby
akem has quit [Ping timeout: 252 seconds]
herbmillerjr has quit [Ping timeout: 240 seconds]
lxsameer has quit [Ping timeout: 252 seconds]
graphene has quit [Read error: Connection reset by peer]
graphene has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
herbmillerjr has joined #ruby
ZzZombo has quit [Remote host closed the connection]
FastJack has quit [Ping timeout: 240 seconds]
FastJack has joined #ruby
idiocrash has joined #ruby
esrse has joined #ruby
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
arescorpio has joined #ruby
kotepillar_ has joined #ruby
RougeR has quit [Ping timeout: 252 seconds]
AJA4350 has quit [Quit: AJA4350]
weaksauce has joined #ruby
thy0 has quit [Quit: TTFN]
bmurt has joined #ruby
safetypin has joined #ruby
safetypin has quit [Quit: ZZZzzz…]
kent\n has quit [Quit: No Ping reply in 180 seconds.]
bmurt has quit [Ping timeout: 240 seconds]
safetypin has joined #ruby
kent\n has joined #ruby
safetypin has quit [Client Quit]
bmurt has joined #ruby
im0nde has quit [Ping timeout: 252 seconds]
pwnd_nsfw has joined #ruby
lektrik has joined #ruby
mwlang has quit [Ping timeout: 240 seconds]
im0nde has joined #ruby
braincrash has quit [Quit: bye bye]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
braincrash has joined #ruby
lxsameer has joined #ruby
lxsameer has quit [Ping timeout: 245 seconds]
soulisson has joined #ruby
<soulisson> Hi. Is there a library in ruby to send and receive netbios/llmnr/mdns requests and responses?
<woodruffw> Resolv::MDNS is part of the stdlib, not familiar with anything for netbios or llmnr though
<soulisson> woodruffw, thank you
<woodruffw> np
Azure has quit [Read error: Connection reset by peer]
bsamorim has joined #ruby
Azure has joined #ruby
arescorpio has quit [Quit: Leaving.]
<bsamorim> Guys, I have a nested module Foo::Bar in my code. If I load my app, calling Foo::Bar.constants doesn't show me Foo::Bar's classes, but I can successfully invoke all its classes in the same scope
<bsamorim> What could be causing it? The app is loaded by invoking "irb -r /path/to/base_file.rb"
Freshnuts has joined #ruby
kotepillar_ has quit [Quit: kotepillar_]
ventures has joined #ruby
<ventures> evening folks, so if I have an existing ruby app, and I want to integrate oh, a user voting system (ala reddits) to an app where all my data is stored in ActiveRecord
kotepillar_ has joined #ruby
<ventures> what would be the safest cleverest way to go about it
<ventures> in making it a useful ranking system
<bsamorim> ventures: rewriting the whole thing in python
<ventures> I don’t like ruby but I’m not rewriting mastodon
kotepillar_ has quit [Client Quit]
<ventures> I don’t much care for mastodon’s layout and internationalization and I’d be happy if they accept the changes I’m gonna make but, they will be drastic
kotepillar_ has joined #ruby
<ventures> it seems easy enough to work on, I also am doing a lot of Elixir now so ruby is no big deal. though personally I would not have pulled it as a weapon of choice
RougeR has joined #ruby
<ventures> oh wait i’m in #ruby.. sorry guys
<ventures> DSL’s are beautiful!
<bsamorim> i guess that Ruby is one of those languages that can yield very bad code if abused
<ventures> anyway any thoughts on a reddit like system? I guess I don’t really need to segregate by date unless I’m sorting by votes
<bsamorim> what do you mean by "integrating"?
<bsamorim> How would their interaction go about?
DTZUZO has joined #ruby
kotepillar_ has quit [Quit: kotepillar_]
bsamorim has quit [Ping timeout: 252 seconds]
orbyt_ has joined #ruby
BTRE has quit [Remote host closed the connection]
ss_much has quit [Quit: Connection closed for inactivity]
BTRE has joined #ruby
lytol_ has quit [Remote host closed the connection]
hays_ has joined #ruby
<hays_> i was wondering what people think of this pattern: https://bpaste.net/show/cec01c8f1a04 I am using a class variable which is usually a no-no
<hays_> but it seems right, since i actually do want the variable to inherit to subclasses
<pwnd_nsfw> Why would you have to use a class variable?
<pwnd_nsfw> attr_accessor?
<hays_> how would you do it
<pwnd_nsfw> does that not inherit?
<hays_> i want do be able to do Point.handler_map(:int16).new
<pwnd_nsfw> As opposed to Point.new.handler_map(:int16)?
<hays_> allowing me to avoid a large case statement
<hays_> do you mean Point.new.handler_map(:int16).new ?
<hays_> that seems inefficient
<pwnd_nsfw> I have nfi what you're doing at this point
<hays_> creating a PointINT16 object
<hays_> based on having a variable with :int16 in it
<hays_> without case variable; when :int16; foo=PointINT16.new; when :int32, etc. etc.
eckhardt has joined #ruby
<pwnd_nsfw> Seems incredibly redundant, at least with this example, to even have different classes
<pwnd_nsfw> I'm sure a more mature example may shed light on that, but currently it doesn't make sense
<pwnd_nsfw> Could just stick with type attribute in Point object
<hays_> I am obviously not showing the implementation, but these classes all have different details of hows things need to be handled
<hays_> definitely looking for a better way
<pwnd_nsfw> Do you have more items to add to that switch? If not, then that's not really all that bad
<hays_> yes i do
<hays_> there are short and long floats, 8 bit variants as well, and possibly others
<hays_> but even that case statement right there is long enough to flag a tool like rubocop
<hays_> plus, that case statement ends up getting copy/pasted to a lot of places since it is outside the class definition
idiocrash has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
idiocrash has joined #ruby
<baweaver> Is there any specific thing those classes do that necessitates a class?
<baweaver> (hays_)
<hays_> yes
<baweaver> Point.new(:int16) # initialize(type) @type = type
<baweaver> Like?
<hays_> there are read and write methods that do very different things
<hays_> when structured like that ^ you end up with big complex methods with a high ABC score
<hays_> those case statements end up in the read/write methods
<baweaver> So move the case branching up to class abstractions
<baweaver> Fair. As far as how to do that, why not namespace?
<hays_> i think that's what im doing?
<hays_> not namespace, but class abstractions
<baweaver> module Point; class Base
<baweaver> then you can just constant get and say something like Point[:uint16].new
<baweaver> Const get
<baweaver> module Point; def self.[](type) const_get(type.upcase)
<baweaver> something kinda vaguely like that
<baweaver> Though that's, to be fair, one of the problems I can never get a good answer for.
<hays_> i don't know enough ruby to quite understand how to implement Point[:uint16].new
<baweaver> One sec
<baweaver> Lemme screw around with something real quick
<hays_> im screwing around too. with maybe a factory pattern
<hays_> something like this maybe https://bpaste.net/show/39a1bc37d463
<hays_> hmm ok that gives me something to think about
ur5us has quit [Remote host closed the connection]
reber has joined #ruby
<hays_> that's .. interesting. const_get
<hays_> class with a k--is that a convention of some kind
<baweaver> class is a reserved word, so whenever referring to something that could turn into class somehow I tend to use k instead of c
<baweaver> I've seen two types, klass and clazz
<baweaver> klass has been far more common in general around meta-programming
<hays_> i sometimes use cls
<hays_> that's probably a bit terse
<baweaver> in general Ruby spells things out
<hays_> yeah. well thanks for that. I would have never thought to use modules in that way
<baweaver> Which I tend to prefer, especially after reading Haskell where they insist on x:xs and names like that
<hays_> long names are nice, but sometimes cause me grief regarding the 80 line limits
<baweaver> (everyone ignores that)
<hays_> haha
<baweaver> 100 is more common
<hays_> its always interesting when you have a chain of methods, how far to take it
<baweaver> mm, I use two space line breaks
<hays_> do you mean \
tristanp has quit [Remote host closed the connection]
dellavg_ has joined #ruby
hays_ has quit [Ping timeout: 240 seconds]
mike11 has joined #ruby
hays_ has joined #ruby
<hays_> hotel wifi. erg
<hays_> how do you speak self.[]
<hays_> "self braces" ?
<baweaver> bracket accessor?
<baweaver> That's a good question
<baweaver> dunno
<hays_> what about []=
<baweaver> bracket setter?
<baweaver> Never thought about either
<hays_> i was trying to explain to someone what these were
<baweaver> apeiros / havenwood: what do you two call em?
kapil___ has joined #ruby
sauvin has joined #ruby
scottj has joined #ruby
duderonomy has joined #ruby
lytol_ has joined #ruby
duderonomy has quit [Client Quit]
siaw23 has joined #ruby
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
Inline has quit [Quit: Leaving]
xfbs has joined #ruby
kotepillar_ has joined #ruby
kotepillar_ has quit [Quit: kotepillar_]
kotepillar_ has joined #ruby
LiftLeft has quit [Ping timeout: 252 seconds]
LiftLeft2 has joined #ruby
soulisson has quit [Remote host closed the connection]
siaw23 has quit [Quit: siaw23]
xfbs has quit [Quit: afk]
za1b1tsu has joined #ruby
armyriad has quit [Quit: Leaving]
MoritaShinobu has joined #ruby
duderonomy has joined #ruby
hays_ has quit [Ping timeout: 272 seconds]
ZzZombo has joined #ruby
<ZzZombo> Anybody to help me yet?
armyriad has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
za1b1tsu has quit [Read error: Connection reset by peer]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
clemens3_ has joined #ruby
za1b1tsu has joined #ruby
aufi has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has quit [Ping timeout: 272 seconds]
duderonomy has joined #ruby
sameerynho has joined #ruby
idiocrash has quit [Quit: Textual IRC Client: www.textualapp.com]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Freshnuts has quit [Quit: Leaving]
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
sameerynho has quit [Ping timeout: 246 seconds]
duderonomy has joined #ruby
yohji has joined #ruby
duderonomy has quit [Ping timeout: 252 seconds]
RougeR has quit [Ping timeout: 252 seconds]
nowhere_man has joined #ruby
cschneid_ has joined #ruby
DTZUZO has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
graphene has quit [Remote host closed the connection]
cschneid_ has quit [Ping timeout: 240 seconds]
graphene has joined #ruby
lunarkitty is now known as lunarkittychan
Freshnuts has joined #ruby
lxsameer has joined #ruby
RougeR has joined #ruby
graphene has quit [Read error: Connection reset by peer]
graphene has joined #ruby
cabotto has joined #ruby
RougeR has quit [Ping timeout: 245 seconds]
RougeR has joined #ruby
TomyWork has joined #ruby
lyr has quit [Quit: The Lounge - https://thelounge.github.io]
lyr has joined #ruby
samort7 has quit [Read error: Connection reset by peer]
Beams has joined #ruby
pabs has joined #ruby
ur5us has joined #ruby
yohji has quit [Ping timeout: 244 seconds]
lyr has quit [Quit: The Lounge - https://thelounge.github.io]
lyr has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
graphene has quit [Remote host closed the connection]
bomb has joined #ruby
graphene has joined #ruby
jottr has joined #ruby
yohji has joined #ruby
za1b1tsu has quit [Read error: Connection reset by peer]
za1b1tsu has joined #ruby
<zxq2> how are you supposed to know what methods generate what exceptions? in mnay cases the documentation sucks
jottr has quit [Ping timeout: 272 seconds]
jottr has joined #ruby
za1b1tsu has quit [Read error: Connection reset by peer]
LiftLeft2 has quit [Quit: Bye]
za1b1tsu has joined #ruby
kapil___ has joined #ruby
govg has joined #ruby
ur5us has quit [Remote host closed the connection]
esrse has quit [Ping timeout: 246 seconds]
Freshnuts has quit [Quit: Leaving]
jottr has quit [Ping timeout: 244 seconds]
ZzZombo has quit [Quit: Going offline, see ya! (www.adiirc.com)]
jottr has joined #ruby
tristanp has joined #ruby
akem__ is now known as akem
tristanp has quit [Ping timeout: 240 seconds]
jottr has quit [Ping timeout: 240 seconds]
kotepillar_ has quit [Quit: kotepillar_]
discopatrick has joined #ruby
yohji has quit [Ping timeout: 246 seconds]
cabotto has quit []
chichou has joined #ruby
za1b1tsu has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
TheBloke- is now known as TheBloke
charlielor has joined #ruby
xall has joined #ruby
jottr has joined #ruby
kotepillar_ has joined #ruby
ZzZombo has joined #ruby
AndreYuhai has joined #ruby
<AndreYuhai> Hi, I have a JSON string from Instagram's page and I've created a class for that. https://dpaste.de/UvYE
<AndreYuhai> But I would like to create an "is_video?" method.
<AndreYuhai> But just on the returned objects from [ ] square brackets
<AndreYuhai> For example: "some_json_obj[1].is_video?" How could I make this work ?
<AndreYuhai> Guess I would have to create a class for edge objects too and then put the method there.
yohji has joined #ruby
thy0 has joined #ruby
jottr has quit [Ping timeout: 244 seconds]
gnufied has quit [Ping timeout: 272 seconds]
jcalla has joined #ruby
kotepillar_ has quit [Quit: kotepillar_]
akem has quit [Ping timeout: 252 seconds]
za1b1tsu has joined #ruby
bmurt has joined #ruby
jottr has joined #ruby
dviola has joined #ruby
impermanence has joined #ruby
AJA4350 has joined #ruby
nowhere_man has quit [Ping timeout: 272 seconds]
impermanence has quit [Ping timeout: 272 seconds]
akem has joined #ruby
knight33 has joined #ruby
akem has quit [Remote host closed the connection]
akem has joined #ruby
yohji has quit [Ping timeout: 252 seconds]
herbmillerjr has quit [Quit: Konversation terminated!]
herbmillerjr has joined #ruby
vondruch has quit [Ping timeout: 244 seconds]
gnufied has joined #ruby
gnufied has quit [Remote host closed the connection]
gnufied has joined #ruby
mike11 has quit [Quit: Leaving.]
jottr has quit [Ping timeout: 252 seconds]
jottr has joined #ruby
yohji has joined #ruby
desperek has joined #ruby
Inline has joined #ruby
Inline has quit [Read error: Connection reset by peer]
Inline has joined #ruby
InfinityFye has joined #ruby
nowhere_man has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sdegutis has joined #ruby
<sdegutis> Hi, is there a method in the stdlib that "groups" a flat array by a given function? For example [0,1,2,3,4,5,6].something{|n| n % 3 == 0 } would become [[0,1,2], [3,4,5], [6]]
<sdegutis> NL3limin4t0r: that is close, but that removes the order which I'm hoping to keep
<sdegutis> Actually that's not close, it returns a different shape than I'm looking for.
<NL3limin4t0r> Never mind, I thought you wanted to group.
<NL3limin4t0r> There is another method that does what you want.
<NL3limin4t0r> Give me a sec
<havenwood> sdegutis: chaunk
<havenwood> chunk*, heh
* havenwood searches for coffee
<sdegutis> What I'm looking for would begin a new group when f(n) is true, and keep adding to the group as long as its false.
<sdegutis> chunk is closer, in fact I just used it for a similar problem 2 seconds before this one, but it doesn't keep them together
<sdegutis> Is there a Ruby evaluator in here?
<sdegutis> Chunk gives me [[true, [0]], [false, [1, 2]], [true, [3]], [false, [4, 5]], [true, [6]]]
<havenwood> >> :nope
<ruby[bot]> havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<sdegutis> But then I'd need to combine every 2 groups into one.
<NL3limin4t0r> Seems like you just want to slice them in parts of 3.
<NL3limin4t0r> >> [0,1,2,3,4,5,6].each_slice(3)
<ruby[bot]> NL3limin4t0r: # => #<Enumerator: [0, 1, 2, 3, 4, 5, 6]:each_slice(3)> (https://eval.in/1057194)
<NL3limin4t0r> >> [0,1,2,3,4,5,6].each_slice(3).to_a
<sdegutis> NL3limin4t0r: for that given function yeah but in real life it's {|s|s.start_with? 'module '}
<ruby[bot]> NL3limin4t0r: # => [[0, 1, 2], [3, 4, 5], [6]] (https://eval.in/1057195)
xall has quit [Ping timeout: 245 seconds]
<havenwood> sdegutis: The expected output you're showing doesn't line up with modulo 3 being zero. Are you trying to flip-flop on the change of state?
<havenwood> [0,1,2,3,4,5,6].chunk { |n| n % 3 == 0 }.map(&:last) #=> [[0], [1, 2], [3], [4, 5], [6]]
<havenwood> sdegutis: ^ that's the expected output for the block: n % 3 == 0
<sdegutis> I'll combine .chunk and .each_slice(2) to get this done, that'll work fine.
<havenwood> sdegutis: Ah, so it's alternating and you want two chunks?
<havenwood> sdegutis: You might be able to express that also with #chunk_while
<NL3limin4t0r> >> (0..6).slice_before { |n| n % 3 == 0 }.to_a
<ruby[bot]> NL3limin4t0r: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<NL3limin4t0r> >> [0,1,2,3,4,5,6].slice_before { |n| n % 3 == 0 }.to_a
<ruby[bot]> NL3limin4t0r: # => [[0, 1, 2], [3, 4, 5], [6]] (https://eval.in/1057199)
<havenwood> NL3limin4t0r: nice
<sdegutis> havenwood: in real life I've got an array of documentation strings where every once in a while one starts with 'module ' and I want to group all the ones afterward with that since they belong to that module
<sdegutis> havenwood: the reason for .each_slice(2) is because .chunk gives me [[true, ['module Foo']], [false, [doc_strings...], ...]
<sdegutis> In that pattern.
graphene has quit [Remote host closed the connection]
<NL3limin4t0r> sdegutis: Does #slice_before fit your issue?
<sdegutis> It looks like it!
<sdegutis> Wow NL3limin4t0r perfect.
graphene has joined #ruby
<sdegutis> NL3limin4t0r, havenwood: this is what I have so far thanks to you guys https://gist.github.com/sdegutis/41094989d41cdcd8fc0459785a3a868f
arup_r has joined #ruby
ZzZombo has quit [Ping timeout: 240 seconds]
<NL3limin4t0r> #map followed by #flatten (flattens recursively) can often be replaced by #flat_map (flattens only one level)
<havenwood> +1 flat_map
<sdegutis> Good call.
thejs has joined #ruby
<havenwood> it is a flatten(1), not a flatten, fwiw
<havenwood> (which should be fine here)
<havenwood> sdegutis: nice
stan has joined #ruby
AndreYuhai has quit [Quit: Page closed]
<sdegutis> How do you pass a regular "function" (method defined in root of file) to foo.map ?
<havenwood> sdegutis: by root of file, do you mean top level in Ruby or something else?
<sdegutis> yes
<sdegutis> havenwood: I'm inside a .map{} in that block and I'm going to write .map{} inside that other map, and I'm trying to avoid defining the inner mapping method there
<sdegutis> So I'm putting it at the top level of the file, but now I forgot how to pass it.
<sdegutis> I haven't done Ruby professionally in like 6 years.
<NL3limin4t0r> So the this `.map { |e| some_method(e) }` can be replaced by `.map(&method(:some_method))`.
<NL3limin4t0r> I guess that's what you mean.
jottr has quit [Ping timeout: 252 seconds]
<sdegutis> Yeah that.
<sdegutis> Thanks NL3limin4t0r.
<NL3limin4t0r> You can also do that for instance methods if you ever need to.
<havenwood> I like the new syntax for that that's been proposed for that: .map(&.:some_method)
<sdegutis> Yeah I've done it with &:foo in the past on instance methods
<NL3limin4t0r> >> str = 'a'; %w[s d f a k e a].map(&str.method(:==))
<ruby[bot]> NL3limin4t0r: # => [false, false, false, true, false, false, true] (https://eval.in/1057205)
<sdegutis> I've fallen out of love with Ruby years ago but it is handy in situations like this.
za1b1tsu has quit [Ping timeout: 252 seconds]
<sdegutis> I just had to type def tmod((name, *docs)) to do destructuring. Neat.
charlielor has quit [Quit: charlielor]
al2o3-cr has quit [Quit: WeeChat 2.2]
bomb has quit [Ping timeout: 244 seconds]
ZzZombo has joined #ruby
charlielor has joined #ruby
gr33n7007h has joined #ruby
gr33n7007h is now known as al2o3-cr
TomyWork has quit [Ping timeout: 246 seconds]
rikkipitt has joined #ruby
yohji has quit [Ping timeout: 245 seconds]
<sdegutis> havenwood, NL3limin4t0r: thanks to you guys it only took 38 lines :D https://gist.github.com/sdegutis/a4b6b94a0f07d87ab85b0d7ee3ff65c1
rikkipitt has quit [Client Quit]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
arup_r has quit [Remote host closed the connection]
NL3limin4t0r is now known as NL3limin4t0r_afk
sdegutis has left #ruby [#ruby]
brandoncc has joined #ruby
fluxAeon has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
za1b1tsu has joined #ruby
akem__ has joined #ruby
akem has quit [Read error: Connection reset by peer]
yohji has joined #ruby
jottr has quit [Ping timeout: 264 seconds]
knight33 has joined #ruby
jottr has joined #ruby
conta1 has joined #ruby
graphene has quit [Remote host closed the connection]
rippa has joined #ruby
graphene has joined #ruby
conta1 has quit [Quit: conta1]
brandoncc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has joined #ruby
Pisuke has joined #ruby
MyMind has quit [Ping timeout: 252 seconds]
charlielor has quit [Quit: charlielor]
beowuff has joined #ruby
ivanskie has joined #ruby
MoritaShinobu has quit [Quit: Leaving]
conta1 has joined #ruby
aufi has quit [Ping timeout: 252 seconds]
akem__ is now known as akem
conta1 has quit [Client Quit]
bmurt has joined #ruby
cagomez has joined #ruby
Dbugger has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
thejs has quit [Ping timeout: 246 seconds]
marz_d`ghostman has joined #ruby
sagax has quit [Remote host closed the connection]
<marz_d`ghostman> Why can I declare a module, a method inside it and invoke the inject(:+) method directly? I though I need to include Enumerable first?
lxsameer has joined #ruby
thejs has joined #ruby
knight33 has quit [Ping timeout: 252 seconds]
jcarl43 has joined #ruby
lxsameer has quit [Ping timeout: 252 seconds]
[Butch] has joined #ruby
lxsameer has joined #ruby
aupadhye has joined #ruby
brandoncc has joined #ruby
lxsameer has quit [Ping timeout: 272 seconds]
charlielor has joined #ruby
lxsameer has joined #ruby
Beams has quit [Quit: .]
yohji has quit [Remote host closed the connection]
lxsameer has quit [Ping timeout: 245 seconds]
lxsameer has joined #ruby
chichou has quit [Ping timeout: 244 seconds]
DTZUZO has quit [Ping timeout: 252 seconds]
lxsameer has quit [Ping timeout: 244 seconds]
lxsameer has joined #ruby
redlegion has quit [Remote host closed the connection]
redlegion has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
aupadhye has quit [Quit: Leaving]
RougeR has quit [Ping timeout: 252 seconds]
orbyt_ has joined #ruby
lxsameer has joined #ruby
chouhoulis has quit [Ping timeout: 244 seconds]
lxsameer has quit [Ping timeout: 245 seconds]
za1b1tsu has quit [Ping timeout: 240 seconds]
arup_r has joined #ruby
lxsameer has joined #ruby
arup_r has quit [Client Quit]
RougeR has joined #ruby
lxsameer has quit [Ping timeout: 244 seconds]
RougeR has quit [Ping timeout: 246 seconds]
<apeiros> marz_d`ghostman: don't know what you mean. can you gist actual reproducible code?
lxsameer has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
eckhardt has joined #ruby
Cthulu201 has quit [Quit: Nowhere special. I always wanted to go there.]
jottr has quit [Ping timeout: 240 seconds]
akem has quit [Ping timeout: 264 seconds]
lxsameer has joined #ruby
Cthulu201 has joined #ruby
akem has joined #ruby
krawchyk has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
za1b1tsu has joined #ruby
arup_r has joined #ruby
lxsameer has joined #ruby
za1b1tsu has quit [Ping timeout: 240 seconds]
za1b1tsu has joined #ruby
krawchyk has quit [Quit: krawchyk]
lxsameer has quit [Ping timeout: 246 seconds]
GodFather_ has joined #ruby
krawchyk has joined #ruby
sagax has joined #ruby
InfinityFye has quit [Quit: Leaving]
duderonomy has joined #ruby
lxsameer has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charlielor has quit [Quit: charlielor]
lxsameer has quit [Ping timeout: 252 seconds]
charlielor has joined #ruby
thejs has quit [Ping timeout: 272 seconds]
ivanskie has joined #ruby
lxsameer has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RougeR has joined #ruby
bmurt has joined #ruby
jottr has joined #ruby
orbyt_ has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
armyriad has quit [Ping timeout: 272 seconds]
samort7 has joined #ruby
akem has quit [Ping timeout: 246 seconds]
armyriad has joined #ruby
lxsameer has joined #ruby
wolfshappen has quit [Ping timeout: 252 seconds]
lxsameer has quit [Ping timeout: 272 seconds]
wolfshappen has joined #ruby
arup_r has quit []
lxsameer has joined #ruby
SeepingN has joined #ruby
sauvin has quit [Remote host closed the connection]
lxsameer has quit [Ping timeout: 240 seconds]
akem has joined #ruby
sameerynho has joined #ruby
LiftLeft has joined #ruby
lxsameer has joined #ruby
lxsameer has quit [Ping timeout: 252 seconds]
lxsameer has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has quit [Ping timeout: 272 seconds]
discopatrick has quit [Quit: Connection closed for inactivity]
lxsameer has joined #ruby
charlielor has quit [Quit: charlielor]
charlielor has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
charlielor has quit [Client Quit]
charlielor has joined #ruby
orbyt_ has joined #ruby
lxsameer has joined #ruby
orbyt_ has quit [Client Quit]
th1nkpad has joined #ruby
dan64 has joined #ruby
thinkpad has quit [Ping timeout: 272 seconds]
th1nkpad is now known as thinkpad
lxsameer has quit [Ping timeout: 244 seconds]
charlielor has quit [Quit: charlielor]
tdy has joined #ruby
dan64 has quit [Ping timeout: 244 seconds]
jottr has quit [Ping timeout: 240 seconds]
lunarkittychan is now known as usagimimibot
usagimimibot is now known as lunarkittychan
thy0 has quit [Quit: TTFN]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charlielor has joined #ruby
thy0 has joined #ruby
DTZUZO has joined #ruby
orbyt_ has joined #ruby
jottr has joined #ruby
dellavg_ has quit [Ping timeout: 252 seconds]
jottr has quit [Ping timeout: 252 seconds]
tdy has quit [Ping timeout: 240 seconds]
charlielor has quit [Quit: charlielor]
thejs has joined #ruby
reber has quit [Remote host closed the connection]
croberts has quit [Ping timeout: 252 seconds]
Dbugger has quit [Ping timeout: 240 seconds]
jp has quit [Ping timeout: 252 seconds]
dviola has quit [Quit: WeeChat 2.2]
dorian has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
krawchyk has quit [Quit: krawchyk]
Azure has quit [Read error: Connection reset by peer]
Azure|dc has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
<dorian> question about circular references: do i have to manage them manually or no?
code_zombie has joined #ruby
DTZUZO has joined #ruby
sanscoeur has joined #ruby
cagomez has quit [Ping timeout: 240 seconds]
cd is now known as tty
desperek has quit [Quit: xoxo]
DTZUZO has quit [Ping timeout: 245 seconds]
DTZUZO has joined #ruby
<leah2> no, ruby's gc handles them fine
cagomez has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<dorian> leah2: how far back does that go?
<dorian> (not that i have to support it; just for my own edification)
<apeiros> dorian: I wouldn't be surprised if it went back to the original ruby
<apeiros> given that afaik ruby started out with a mark & sweep gc, which has no issues with circular refs.
<dorian> ah yes
<leah2> dorian: since always
<dorian> good to know
* dorian inured to perl Scalar::Util::weaken
\void has joined #ruby
za1b1tsu has quit [Ping timeout: 240 seconds]
<apeiros> it's been 2 decades since I did perl, so no idea what that's supposed to mean
<dorian> it's a thing you have to do to decrement the reference count of a data object so it gets properly GC'd
<dorian> (if circular, that is)
<dorian> anyway no bother
<apeiros> perl uses a counting gc?
<dorian> yeah there was talk of moving to mark and sweep a while back but i think they gave up on that
<dorian> ("a while back" being like 15 years)
lxsameer has joined #ruby
croberts has joined #ruby
tdy has joined #ruby
chouhoulis has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
mustmodify has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
chouhoulis has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu has joined #ruby
g- has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
za1b1tsu has quit [Ping timeout: 252 seconds]
leitz has joined #ruby
lytol_ has quit [Remote host closed the connection]
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
<leitz> Confused on why the tests pass but the program fails. In theory the offending include should be tested, right? https://gist.github.com/LeamHall/f6181aed2d0a1ce26114af399ebee448
orbyt_ has joined #ruby
tty is now known as cd
DTZUZO has quit [Ping timeout: 252 seconds]
orbyt_ has quit [Client Quit]
chouhoulis has quit [Ping timeout: 246 seconds]
orbyt_ has joined #ruby
chouhoulis has joined #ruby
sameerynho has quit [Ping timeout: 244 seconds]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has quit [Ping timeout: 252 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has joined #ruby
jottr has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
orbyt_ has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
jottr has quit [Ping timeout: 252 seconds]
Puffball has quit [Remote host closed the connection]
graphene has quit [Remote host closed the connection]
ivanskie has joined #ruby
tdy has joined #ruby
graphene has joined #ruby
chouhoulis has joined #ruby
ciro has joined #ruby
tdy has quit [Ping timeout: 252 seconds]
pablo_ has joined #ruby
nickjj has quit [Read error: Connection reset by peer]
chouhoulis has quit [Ping timeout: 272 seconds]
chouhoulis has joined #ruby
za1b1tsu has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
chouhoulis has quit [Ping timeout: 245 seconds]
za1b1tsu has quit [Ping timeout: 246 seconds]
chouhoulis has joined #ruby
ivanskie has quit [Quit: Textual IRC Client: www.textualapp.com]
snickers has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
nickjj has joined #ruby
<leitz> Sooner or later I have to figure out the circular loading issue.
<leitz> But the program works, again. Finally!
mustmodify has left #ruby [#ruby]
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 245 seconds]
chouhoulis has joined #ruby
ellcs has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
snickers has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Azure|dc has quit [Read error: Connection reset by peer]
ramfjord has joined #ruby
postmodern has joined #ruby
Azure has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #ruby
chouhoulis has quit [Ping timeout: 246 seconds]
sanscoeu_ has joined #ruby
sanscoeur has quit [Ping timeout: 252 seconds]
jcarl43 has quit [Quit: WeeChat 2.2]
chouhoulis has joined #ruby
sanscoeu_ has quit [Ping timeout: 272 seconds]
thejs has quit [Read error: Connection reset by peer]
tdy has joined #ruby
Azure has quit [Read error: Connection reset by peer]
Azure has joined #ruby
lxsameer has joined #ruby
chouhoulis has quit [Ping timeout: 252 seconds]
chouhoulis has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
ellcs has quit [Ping timeout: 240 seconds]
chouhoulis has quit [Ping timeout: 244 seconds]
chouhoulis has joined #ruby
gix has quit [Ping timeout: 245 seconds]
leitz has quit [Quit: Leaving]
gix has joined #ruby
lunarkittychan is now known as notlunarktty
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has quit [Ping timeout: 252 seconds]
notlunarktty is now known as lunarkittychan
chouhoulis has joined #ruby
fredlinhares has joined #ruby
sticaz has joined #ruby
chouhoulis has quit [Ping timeout: 272 seconds]
eckhardt has joined #ruby
chouhoulis has joined #ruby
chouhoulis has quit [Ping timeout: 244 seconds]
chouhoulis has joined #ruby
spiette has quit [Quit: ZNC 1.7.1 - https://znc.in]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has quit [Ping timeout: 244 seconds]
chouhoulis has joined #ruby
spiette has joined #ruby
bhaak has quit [Ping timeout: 246 seconds]
eckhardt has joined #ruby
mememeIAMMEE has joined #ruby
<mememeIAMMEE> Hellop
chouhoulis has quit [Ping timeout: 240 seconds]
<mememeIAMMEE> How do I add values to an existing hash key, accessing the key via string like this, a = 'hashKey'; hash[a] << 98;
chouhoulis has joined #ruby
<havenwood> mememeIAMMEE: Are you trying to mutate the `a` local variable by shoveling on a `"b"` string so `a == "hashKeyb"`?
ZzZombo has quit [Ping timeout: 240 seconds]
<havenwood> mememeIAMMEE: There is a Hash#rehash method, but it's advised not to mutate Hash keys.
<mememeIAMMEE> Say hashKey[:"myKey"] == [0, 1, 2]
<mememeIAMMEE> All I want to do is
chouhoulis has quit [Ping timeout: 245 seconds]
<havenwood> mememeIAMMEE: An aside, but: :"myKey" == :myKey
<havenwood> mememeIAMMEE: Use :snake_case instead of :headlessCamelCase for symbols
<mememeIAMMEE> g = "myKey"; myHash[g] << 3; to make myHash[:"myKey"] == [0, 1, 2, 3]
chouhoulis has joined #ruby
<mememeIAMMEE> I come from C#, sorry lol.
<Zarthus> you can do `g.to_sym` or `g = :my_key`
<havenwood> >> g = 'my key'; my_hash = {g => '4'}; my_hash[g] << '2'; my_hash # mememeIAMMEE, so this is the base Hash setup?
<mememeIAMMEE> So you can't shovel values into a hash like you do an array? a << b
<havenwood> #=> {"my key"=>"42"}
<ruby[bot]> havenwood: # => {"my key"=>"42"} (https://eval.in/1057304)
<havenwood> mememeIAMMEE: String#<< is a method too.
<havenwood> mememeIAMMEE: I'm confused what you're trying to do.
<havenwood> mememeIAMMEE: Do you want to change the Hash key or value?
<mememeIAMMEE> What's the # for? I thought it was only used for comments and string parsing.
<mememeIAMMEE> the value
<mememeIAMMEE> i want to append a value
<mememeIAMMEE> \
<havenwood> mememeIAMMEE: If the value is an Array, you can append to it with Array#<<, just like you seem to be thinking.
<havenwood> mememeIAMMEE: The # in Array#<< just means an instance method
<havenwood> [] << 42 #=> [42]
<mememeIAMMEE> so from hash[:key] => [0, 1, 2] to hash[:key] => [0, 1, 2, 3]
<havenwood> mememeIAMMEE: yup, that works
<havenwood> mememeIAMMEE: the Array key will mutate to add the new item
<havenwood> Array value**
<havenwood> now I'm doing it too!
chouhoulis has quit [Ping timeout: 252 seconds]
<mememeIAMMEE> Is there somewhere I can post my program so I don't spam irc?
xall has joined #ruby
<havenwood> ?gist
<ruby[bot]> https://gist.github.com - Multiple files, syntax highlighting, even automatically with matching filenames, can be edited
<havenwood> Or https://dpaste.de/ if you don't have a Github acct.
chouhoulis has joined #ruby
<havenwood> mememeIAMMEE: You can create a Hash with a default value of an empty Array like: my_hash = Hash.new { |h, k| h[k] = [] }
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mememeIAMMEE> This isn't working https://dpaste.de/eSDx
<havenwood> >> my_hash = Hash.new { |h, k| h[k] = [] }; my_hash[:example] << 42; my_hash
<ruby[bot]> havenwood: # => {:example=>[42]} (https://eval.in/1057305)
<havenwood> mememeIAMMEE: The default value for that Hash is `nil`, and you can't shovel onto `nil`.
<mememeIAMMEE> I thought I was adding a key
<havenwood> >> {}.default
<ruby[bot]> havenwood: # => nil (https://eval.in/1057306)
<havenwood> mememeIAMMEE: When you add a key, the corresponding default value is `nil`.
<havenwood> >> {}.default
<ruby[bot]> havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<havenwood> #=> nil
<havenwood> mememeIAMMEE: So this is trying to shovel `42` onto `nil`:
<havenwood> >> {}[:example] << 42
<ruby[bot]> havenwood: # => undefined method `<<' for nil:NilClass (NoMethodError) ...check link for more (https://eval.in/1057307)
<havenwood> mememeIAMMEE: Hence: undefined method `<<' for nil:NilClass
<havenwood> mememeIAMMEE: Compare with:
<havenwood> >> Hash.new { |h, k| h[k] = [] }[:example] << 42
<ruby[bot]> havenwood: # => [42] (https://eval.in/1057308)
<mememeIAMMEE> Ahh so I was simply declaring my hash incorrectly. Thank you
xall has quit [Ping timeout: 252 seconds]
chouhoulis has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
chouhoulis has joined #ruby
<havenwood> mememeIAMMEE: No prob - this is another way to write it:
<havenwood> >> h = {}; h.default_proc = -> h, k { h[k] = [] }; h[:example] << 42
<ruby[bot]> havenwood: # => [42] (https://eval.in/1057309)
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
<mememeIAMMEE> Any simpler, easier to remember, ways to write it? Trying to stuff a bunch of new syntax in my head for an interview in 3 days. Never touched Ruby in my life.
<mememeIAMMEE> Many differences from my usual
za1b1tsu has joined #ruby
cagomez has quit [Remote host closed the connection]
<havenwood> mememeIAMMEE: Instead of a default proc of an empty Array, you can manually make sure there's an Array for your value before shoveling:
<havenwood> >> h = {}; h[:example] ||= []; h[:example] << 42
<ruby[bot]> havenwood: # => [42] (https://eval.in/1057311)
jottr has quit [Ping timeout: 240 seconds]
cagomez has joined #ruby
chouhoulis has quit [Ping timeout: 244 seconds]