havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: 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!
braincrash has joined #ruby
dionysus69 has quit [Quit: dionysus69]
adu has quit [Ping timeout: 240 seconds]
sort_of_uplime has quit [Quit: Connection closed]
impermanence has quit [Ping timeout: 260 seconds]
bsgmx has joined #ruby
<bsgmx> hola!
braincrash has quit [Ping timeout: 240 seconds]
ChmEarl has quit [Quit: Leaving]
alfiemax has joined #ruby
aldoescudero has joined #ruby
Rudd0 has quit [Ping timeout: 240 seconds]
bmurt has joined #ruby
NeilCarvalho has joined #ruby
NeilCarvalho has quit []
info has joined #ruby
info has quit [Client Quit]
alexherbo2 has quit [Ping timeout: 240 seconds]
jcsaba has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
alfiemax has quit [Ping timeout: 240 seconds]
nofxx has joined #ruby
jcsaba has quit [Quit: Leaving]
cthu| has quit [Read error: Connection reset by peer]
cthu| has joined #ruby
cthu| has quit [Read error: Connection reset by peer]
cthu| has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #ruby
orbyt_ has joined #ruby
sylario has quit [Quit: Connection closed for inactivity]
bitwinery has joined #ruby
bruce_lee has quit [Ping timeout: 258 seconds]
bruce_lee has joined #ruby
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bitwinery has quit [Remote host closed the connection]
* bsgmx
* bsgmx isa a
bmurt has joined #ruby
Technodrome has joined #ruby
bsgmx has left #ruby [#ruby]
ur5us_ has joined #ruby
_whitelogger has joined #ruby
ErhardtMundt has quit [Remote host closed the connection]
ErhardtMundt has joined #ruby
sgen has quit [Ping timeout: 256 seconds]
hassox_ has quit [Quit: Leaving...]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bsgmx has joined #ruby
snosk8r has joined #ruby
Secret-Fire has quit [Remote host closed the connection]
Secret-Fire has joined #ruby
darkstardevx has quit [Ping timeout: 260 seconds]
DaRock has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
leah2 has joined #ruby
elcuervo has quit [Read error: Connection reset by peer]
elcuervo has joined #ruby
sgen has joined #ruby
ur5us_ has quit [Ping timeout: 260 seconds]
bsgmx has quit [Ping timeout: 256 seconds]
cthu| has quit [Ping timeout: 240 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 240 seconds]
roshanavand_ is now known as roshanavand
Blacink has quit [Quit: This computer has gone to sleep]
mac_ has quit [Quit: This computer has gone to sleep]
skape has quit [Quit: Connection closed for inactivity]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has joined #ruby
Blacink has joined #ruby
mac_ has joined #ruby
sgen has quit [Ping timeout: 265 seconds]
skape has joined #ruby
gix- has joined #ruby
gix has quit [Disconnected by services]
RiPuk has quit [Quit: ZNC 1.8.1 - https://znc.in]
RiPuk has joined #ruby
Emmanuel_ChanelW has joined #ruby
Rudd0 has joined #ruby
coniptor has quit [Ping timeout: 260 seconds]
Blacink has quit [Quit: This computer has gone to sleep]
mac_ has quit [Quit: This computer has gone to sleep]
_whitelogger has joined #ruby
coniptor has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.9]
dualfade has quit [Ping timeout: 258 seconds]
dualfade has joined #ruby
aldoescudero has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 260 seconds]
aldoescudero has joined #ruby
bocaneri has joined #ruby
coniptor has quit [Ping timeout: 240 seconds]
Technodrome has joined #ruby
jenrzzz has joined #ruby
sgen has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
aldoescudero has quit [Remote host closed the connection]
coniptor has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
sgen has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
aldoescudero has joined #ruby
aldoescudero has quit [Ping timeout: 256 seconds]
yasumi2136_ has quit [Quit: Konversation terminated!]
mozzarella has quit [Read error: Connection reset by peer]
_aeris_ has quit [Ping timeout: 240 seconds]
_aeris_ has joined #ruby
aldoescudero has joined #ruby
aldoescudero has quit [Ping timeout: 240 seconds]
imode has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 265 seconds]
dfucci has joined #ruby
aldoescudero has joined #ruby
aldoescudero has quit [Ping timeout: 256 seconds]
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rudd0 has quit [Ping timeout: 264 seconds]
cliluw has quit [Ping timeout: 265 seconds]
cliluw has joined #ruby
Blacink has joined #ruby
mac_ has joined #ruby
jenrzzz has joined #ruby
aldoescudero has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
aldoescudero has quit [Ping timeout: 265 seconds]
dhollinger has quit [Ping timeout: 265 seconds]
dhollinger has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #ruby
akem has joined #ruby
Rudd0 has joined #ruby
alexherbo2 has joined #ruby
akem has quit [Remote host closed the connection]
gueorgui_ is now known as gueorgui
akem has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
TCZ has joined #ruby
akem has quit [Quit: AndroIRC - Android IRC Client ( http://www.androirc.com )]
RiPuk has quit [Quit: ZNC 1.8.1 - https://znc.in]
RiPuk has joined #ruby
sgen has joined #ruby
rippa has joined #ruby
aldoescudero has joined #ruby
aldoescudero has quit [Ping timeout: 258 seconds]
teo_ has joined #ruby
teo_ has left #ruby [#ruby]
akem has joined #ruby
akem has quit [Client Quit]
akemhp has joined #ruby
rhe_ has quit [Quit: ZNC - https://znc.in]
rhe has joined #ruby
Technodrome has joined #ruby
rhe_ has joined #ruby
rhe has quit [Read error: Connection reset by peer]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
coniptor has quit [Ping timeout: 260 seconds]
akemhp has quit [Quit: Somebody...jump in that computer server...and take the information out. ;]]
coniptor has joined #ruby
dfucci has joined #ruby
RiPuk_ has joined #ruby
RiPuk has quit [Read error: Connection reset by peer]
ruurd has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
dfucci has joined #ruby
ruurd has quit [Client Quit]
dfucci has quit [Ping timeout: 246 seconds]
dfucci has joined #ruby
old_relik has joined #ruby
cd has joined #ruby
<old_relik> I have a hash like this https://dpaste.org/BJQA
<old_relik> it's basically grouped by the group_id
<old_relik> I want to further group this by the parent_id in the group, what's an easy way of doing that?
<old_relik> such that it becomes like the following: https://dpaste.org/gBbU
<old_relik> Where Parent1 and Parent2 are also Rails-y objects
<old_relik> If I do a simple group by on the group map, the values end up becoming tuples
<old_relik> and don't stay maps
<old_relik> not even tuples, it just gets destructured into a flattish array
<old_relik> like { Parent1 => [[Group1, [child1, child2]], [Group2, [child3, child4]]] }
<old_relik> nvm, they are tuples
<old_relik> in any case, is there a simple one-pass way of making this structure
dfucci has quit [Read error: Connection reset by peer]
GodFather has joined #ruby
dfucci_ has joined #ruby
braincrash has joined #ruby
arahael has left #ruby ["WeeChat 2.7.1"]
dualfade has quit [Ping timeout: 256 seconds]
dualfade has joined #ruby
dfucci_ has quit [Ping timeout: 246 seconds]
old_relik has quit [Remote host closed the connection]
<leftylink> what the hell
<leftylink> I had just finished thinking of how I want to answer the question
<leftylink> that is really frustrating
<leftylink> and I am powerless to do anything about it! that is what makes it the most frustrating
<leftylink> like, sure, I can withhold my answer (which I will), but that has absolutely no effect on the state of affairs, so it's not even like it's a punitive measure that achieves any sense of justice
<leftylink> so people who get off on spite won't even be satisfied
<leftylink> don't drink and irc
<leftylink> goodbye for now while I cool off ("cool off" being a euphemism for what is actually happening)
ChmEarl has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BrianWGray has joined #ruby
Emmanuel_ChanelW has quit [Quit: Leaving]
GodFather has quit [Ping timeout: 260 seconds]
aldoescudero has joined #ruby
hiroaki has joined #ruby
aldoescudero has quit [Ping timeout: 256 seconds]
cuerbot has joined #ruby
elcuervo has quit [Ping timeout: 264 seconds]
skape has quit [Quit: Connection closed for inactivity]
howdoi has joined #ruby
ruurd has joined #ruby
vqrs has quit [Ping timeout: 272 seconds]
vqrs has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
Rudd0 has quit [Remote host closed the connection]
_whitelogger has joined #ruby
akemhp has joined #ruby
ams___ has joined #ruby
adu has joined #ruby
akemhp has quit [Remote host closed the connection]
akemhp has joined #ruby
akemhp has quit [Remote host closed the connection]
adu has quit [Quit: adu]
skape has joined #ruby
akemhp has joined #ruby
Rudd0 has joined #ruby
davispuh has joined #ruby
akemhp has quit [Remote host closed the connection]
TCZ has quit [Quit: Leaving]
akemhp has joined #ruby
akemhp has quit [Remote host closed the connection]
sgen has quit [Ping timeout: 246 seconds]
aldoescudero has joined #ruby
adu has joined #ruby
DaRock has quit [Ping timeout: 240 seconds]
GodFather has joined #ruby
akemhp has joined #ruby
per1 has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
akemhp_ has joined #ruby
Asa has joined #ruby
Asa is now known as Guest5257
orbyt_ has joined #ruby
aldoescudero has quit [Ping timeout: 265 seconds]
PikaChokeMe has quit [Quit: Leaving]
jenrzzz has joined #ruby
Blacink has quit [Quit: This computer has gone to sleep]
mac_ has quit [Quit: This computer has gone to sleep]
Blacink has joined #ruby
mac_ has joined #ruby
nofxx has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 264 seconds]
nofxx has joined #ruby
tumdum has quit [Remote host closed the connection]
tumdum has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
adu has quit [Quit: adu]
imode has joined #ruby
mozzarella has joined #ruby
aldoescudero has joined #ruby
aldoescudero has quit [Ping timeout: 256 seconds]
dfucci has joined #ruby
jenrzzz has joined #ruby
GodFather has quit [Ping timeout: 260 seconds]
orbyt_ has joined #ruby
ams___ has quit [Quit: Connection closed for inactivity]
jenrzzz has quit [Ping timeout: 260 seconds]
per1 has quit [Quit: Leaving]
mac_ has quit [Quit: This computer has gone to sleep]
Blacink has quit [Quit: This computer has gone to sleep]
howdoi has quit [Quit: Connection closed for inactivity]
dviola has quit [Quit: WeeChat 2.9]
dviola has joined #ruby
Guest5257 has quit [Ping timeout: 240 seconds]
Rudd0 has quit [Remote host closed the connection]
neshpion has joined #ruby
aandrew has joined #ruby
dfucci has quit [Read error: Connection reset by peer]
weaksauce has joined #ruby
TCZ has joined #ruby
aldoescudero has joined #ruby
mac_ has joined #ruby
Blacink has joined #ruby
shokohsc has quit [Ping timeout: 256 seconds]
howdoi has joined #ruby
cnsvc has joined #ruby
dionysus69 has joined #ruby
go|dfish has quit [Quit: WeeChat 1.4]
go|dfish has joined #ruby
Blacink has quit [Quit: Leaving]
mac_ has quit [Quit: Leaving]
s3nd1v0g1us has joined #ruby
s3nd1v0g1us has quit [Read error: Connection reset by peer]
Emmanuel_Chanel has quit [Quit: Leaving]
<nakilon> when I'm developing a gem, how am I supposed to install what's listed as add_development_dependency?
<havenwood> nakilon: Typically there's a Gemfile with a `gemspec` line which installs those when you run `bundle`.
<havenwood> nakilon: How deps are installed is just by convention so it may vary.
<havenwood> nakilon: Typically, install deps with `bundle` and run tests with `rake`.
<havenwood> nakilon: Or rather: bundle exec rake
<nakilon> oh indeed, didn't know this Gemfile thing installs dev deps
<havenwood> nakilon: It does if you have the `gemspec` directive, which I do for gems and see commonly.
<nakilon> yep
<nakilon> otherwise there is no point in having Gemfile in the gem repo though
Emmanuel_Chanel has joined #ruby
jcsaba has joined #ruby
adu has joined #ruby
ChmEarl has quit [Quit: Leaving]
Secret-Fire has quit [Remote host closed the connection]
cliluw has quit [Read error: Connection reset by peer]
cliluw has joined #ruby
Secret-Fire has joined #ruby
TCZ has quit [Quit: Leaving]
cliluw has quit [Ping timeout: 246 seconds]
cliluw has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
ur5us_ has joined #ruby
weaksauce has quit [Quit: Textual IRC Client: www.textualapp.com]
weaksauce has joined #ruby
Rudd0 has joined #ruby
<nakilon> imagine there is some popular lib/gem/framework with its classes and I made a gem that adds functionality to some class of it
<nakilon> the OOP tells me that since the custom routines that I implement are going to be executes only around that class I have to include my module into it
<nakilon> now what if years later that class starts having the method with the same name as one that I made for my functionality? should I kind of "move"? rename my stuff to avoid collisions?
<nakilon> I wonder if there are any other ways to solve the issue
ruurd has quit [Read error: Connection reset by peer]
ruurd has joined #ruby
cliluw has quit [Ping timeout: 260 seconds]
cliluw has joined #ruby
adu has quit [Quit: adu]
postmodern has joined #ruby
<havenwood> nakilon: When you want to add pluggable functionality to a gem. Plugins are pretty common and work well. https://guides.rubygems.org/plugins/
<havenwood> nakilon: Well that link is plugins to rubygems itself, but namespace under the gem. Let me find a link.
<havenwood> nakilon: net-http-persistent and net-http-digest_auth are examples here: https://guides.rubygems.org/name-your-gem/
<havenwood> (Plugins to net-http.)
<havenwood> nakilon: See how Pry plugins are done: https://github.com/pry/pry/wiki/Available-plugins
aldoescudero has quit [Remote host closed the connection]
aldoescudero has joined #ruby
aldoescudero has quit [Ping timeout: 240 seconds]
neshpion has quit [Quit: WeeChat 2.9]
powerhouse has joined #ruby
aandrew has left #ruby [#ruby]
shokohsc has joined #ruby
neshpion has joined #ruby
<nakilon> the case of cry is not very clear to me -- I guess they have the plugins pattern from the beginning
<nakilon> the case of Net::HTTP -- they add a submodule/subclass, not expand an existing one with new methods
<nakilon> imagine it's Selenium::WebDriver::Node or Ferrum::Node -- instances that their libraries instantiate massively whenever they want, and I want a Node to have my method
pwnd_sfw has quit [Remote host closed the connection]
<havenwood> nakilon: By not commingling plugin methods you can have many plugins without stomping on each other.
<nakilon> Net::HTTP is actually a module while ...::Node is a class
<havenwood> nakilon: Either way, you can have plugins. If it's a core feature, make it core.
<havenwood> nakilon: If you have some code, we could advise. With what you've said, I'd suggest avoid a design where you're accreting modules in mix in to a core, since you'll just end up with a god object with methods stomping on each other.
<havenwood> nakilon: The only reasons for modules and classes is to make it easier for us humans.
<havenwood> Try the simplest thing that can possibly work first.
<havenwood> nakilon: As a general principle, make plugins pluggable and don't stomp on core behavior.
<havenwood> nakilon: If you have specific code, someone in the channel may have specific suggestions.
<nakilon> the simpliest thing is to make user able to call node.my_cool_method where node is from someone's library and my_cool_method is mine; but I can't garauntee that they won't add the same method too
<havenwood> nakilon: Well, it's simpler to just reopen the class.
<havenwood> nakilon: But we want to avoid method collision, so use a separate namespace for plugins typically.
<nakilon> I mean I'll overwrite the existing method and it will break
<nakilon> if Node was a Module it would not be a problem since I could put my module inside
<nakilon> but it's a class
<havenwood> nakilon: When you say "put my module inside" what do you mean?
<havenwood> nakilon: You can namespace within a class. And you can mixin to a class. What is it you're trying to do that a class doesn't work?
<nakilon> I mean a = Theirmodule::Myextention.new; a.cool_method()
<havenwood> nakilon: You can mixin to a class. Consider whether you should be mixing in though.
<havenwood> nakilon: What's the problem with?: a = Theirmodule::Myextention.new; a.cool_method()
<havenwood> Seems fine to me?
<havenwood> Concrete code might help.
<havenwood> Or maybe someone else get's what the problem is.
<havenwood> gets*
<havenwood> (I'm multitasking at the moment. Saturday! \o/)
<nakilon> Node is a class, the webdriver node (after you find it on the page with css/xpath selector) is an instance that has it's own methods designed my Webdriver/Selenium developers to be called via . (dot)
<nakilon> but if I want to call my cool method via dot too there can appear a collision if they come up with the same method name in future
<nakilon> *designed by
Rounin has quit [Remote host closed the connection]
<havenwood> nakilon: You can design it in many ways. For example: Node.new.your_plugin.novel_method
<havenwood> nakilon: Method chaining is one option.
<nakilon> the collision will happen no matter what the implementation is -- my question is are there any other nice ways to add my method other than calling it via dot
<nakilon> Node.new.your_plugin.novel_method -- now my plugin collides with their method )
<havenwood> nakilon: Do they have a method called #your_plugin already?
<nakilon> they will tomorrow
<havenwood> nakilon: Typically you don't allow two plugins of the same name.
<havenwood> nakilon: The name of your gem or plugin must be unique, then you namespace under it to avoid any collisions.
<havenwood> nakilon: Namespaces of plugins are what keep plugins separate. They must be named differently.
<havenwood> nakilon: Similarly, namespaces of gems are what keep gems separate.
<nakilon> "namespace under it" -- it's a case about module, not the class instance
<havenwood> nakilon: You can namespace under either. I don't really get the problem here.
<nakilon> you can't namespace under the instance
<havenwood> nakilon: There are all sorts of ways to add behavior to an instance without colliding. You can enclose around it like `Node::Foo(node)` or you can have a convention for plugins having a method namespace like `node.foo.bar` or all sorts of ways depending on what you're doing.
<havenwood> nakilon: In Ruby there are almost always many ways to do it. I suspect there're many ways to do what you're asking. If you can extract a code example I'm sure folk here can suggest a few ways.
<nakilon> Node::Foo(node) -- this is interesting, but makes code bigger
leitz has joined #ruby
<havenwood> nakilon: Basically, come up with a convention for your plugins. For example, Roda has a nice plugin system: https://github.com/jeremyevans/roda/tree/master/lib
<havenwood> nakilon: Roda or Sequel are examples of pretty robust plugins that tie into core behavior with a set of conventions.
<havenwood> nakilon: Most plugins aren't that entangled, so they have a simpler design.
<havenwood> nakilon: Roda and Sequel are examples of designing a core system around extensible plugins.
Rounin has joined #ruby
<havenwood> nakilon: Roda plugins: https://github.com/jeremyevans/roda#label-Plugins
<havenwood> nakilon: If you want to entangle plugins deeply, design around a convention like Roda and Sequel do. Typically, a class/module namespace suffices like the Pry plugins I linked above - which are more shallowly entangled and therefore require less adherence to convention.
<havenwood> nakilon: Elegant plugins are probably seen less often than they should be, ideally. I do think it's a worthwhile endeavor to study excellent implementations for ideas. In general, keep it as simple as you can.
<havenwood> A small core is a worthy target for many cases, so plugins can be handy.
<nakilon> thanks for the links
<havenwood> no prob - any time
aandrew has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jetchisel has joined #ruby
ur5us_ has quit [Ping timeout: 244 seconds]
Emmanuel_ChanelW has joined #ruby