<ramfjord>
hehe yeah, that and the entire library. Also I do think that if you don't have named arguments, then if you pass arguments in named syntax they will resolve to a hash in modern ruby versions. So perhaps without dynamically defining the named arguments, you can just have a single parameter in the constructor, and validate the required/optional arguments in the hash you get. ie.
<ruby[bot]>
ramfjord: # => {:named_arg=>123, :other=>213} ...check link for more (https://eval.in/1012881)
<ramfjord>
well, the `inspect` isn't super clear, but `h` is a Hash if I print that out as well
cajone has joined #ruby
<ramfjord>
also re. your README - I do think most people would classify ruby as a language with multiple inheritance - through mixins
rfoust has joined #ruby
<trevoke>
So I definitely had the **kwags before (or rather still have it right now), and I had a custom error and it worked out alright, but a benefit of actual named arguments _might_ be rubymine or other editor support (I wonder how deep their dynamic programming support is, I should try this out...)
<ramfjord>
also I kind of agree with @baweaver - if you want to do the command pattern, you can just closure in the arguments to a proc by wrapping the function invocation in ->() { my_func(arg1, arg2, ...) }, and then call that whenever
<trevoke>
I'd love to hear "most people"'s reasoned arguments about why composition is the same thing as multiple inheritance :D
<trevoke>
And yes, you are absolutely right, I'm aware I can do that. The reasons this exists are complex and varied and much more social than technical.
<ramfjord>
composition is having objects in your objects, mixins can define instance variables on your objects, which IMO is more like multipe inhertiance. Consider the Enumerable module. When I mix it in to my Class that has an #each method, it's much like inheriting from a class that's already included Enumerable... I suppose in my mind composition would be if Enumerable were a class, and I had in my object a
<trevoke>
So if you want to jump on the "technology doesn't solve social problems" bandwagon, let's please not start, I know, I can't even play devil's advocate.
<ramfjord>
reference to an instance of Enumerable.
<trevoke>
I believe what you are referring to is dependency injection?
lxsameer has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
<baweaver>
Enumerable, Sortable, etc etc. There are a few of them
<ramfjord>
well, I would say that dependency injections supplies the types for an object that uses composition
<baweaver>
Honestly they're more of interfaces than anything
<ramfjord>
or the objects itself
<ramfjord>
dependency injection is delegating the attachment of composed objects to an external class
<ramfjord>
they are like recent java versions' default interface implementation, which IMO is basically multiple inheritance as well
<baweaver>
implements Enumerable
cagomez has quit [Remote host closed the connection]
grilix_ has quit [Read error: Connection reset by peer]
grilix_ has joined #ruby
Azure has quit [Quit: Oops.]
<trevoke>
ramfjord: if Ruby has multiple inheritance through mixins, then what's the difference between "X < Y" and "includes Y" ?
cagomez has joined #ruby
<baweaver>
social convention, mostly.
<baweaver>
Some things are distinctly base objects that are inheritable
<baweaver>
Others are a group of behaviors that make sense with an '-able' name
<baweaver>
Transducers are fun, but that's one heck of a rabbit hole.
jeen has quit [Client Quit]
Azure has joined #ruby
cagomez has quit [Ping timeout: 256 seconds]
<trevoke>
baweaver: no fair your answering the question I'm asking him
<trevoke>
How will I know what he's thinking now?
lxsameer has quit [Ping timeout: 244 seconds]
<trevoke>
spoiler alert, I agree with your perspective -- _especially_ in Ruby, and I believe that's one of the special things that make Ruby amazing.
<ramfjord>
trevoke: that's a good question - and I'd say there isn't much difference in terms of the effect they have. By convention you would make something a module if you don't want to instantiate it, and it will be used in multiple places. Make something a class and use inheritance if you want to instantiate the superclass.
<trevoke>
Its almost complete lack of language-enforced conventions allows us to focus almost entirely on *purpose*, and that's really nice.
<ramfjord>
>> module Mod; attr_accessor :a ; def initialize() ; @a = 123 ; end ; end ; class B ; include Mod ; end ; B.new.a
<baweaver>
but it also explains why I mysteriously stopped writing articles a few weeks back
<trevoke>
Good to know that _why's spirit is alive and well.
<agent_white>
trevoke: I think that's why I love it. It changed the way I think about OOP design as a whole.
<baweaver>
The two books that started me on Ruby were Why's guide and Eloquent Ruby
<trevoke>
Eloquent Ruby is good. My recommendations to get people started are POODR and Avdi Grimm's Confident Ruby
<trevoke>
Confident Ruby is a treasure trove of idiomatic Ruby
<baweaver>
avdi occasionally hangs around the channel too
<baweaver>
though he's more often on Twitter nowadays.
<trevoke>
I ran across him a few times a few years ago. I was still relatively starstruck and didn't know how to approach him. Now I think I could totally have a real human conversation with him.
orbyt_ has joined #ruby
<trevoke>
Anyway. Point being, when you can focus on message passing then everything becomes about, as Sandi would put it, "which object, existing or not, should receive this message?" and it's a very helpful little refactoring mantra.
<trevoke>
And even back to my horrible horrible code, I got it to work by doing a class eval of a string version of the self.new method and it's pretty much the absolute worst Ruby code I've written in my entire life.
<trevoke>
The only reason I wrote this in the first place is because someone wrote an abstract class to do the command pattern in this codebase I'm working with and it's just ... painfully boilerplatey
<trevoke>
And I told someone that if I had to use any kind of defined contract, I was going to do it via a DSL because that was how I could eat the most boilerplate.
<trevoke>
... Then I got drunk.
gix has joined #ruby
gix- has quit [Ping timeout: 260 seconds]
dviola has joined #ruby
lxsameer has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
<baweaver>
So it was just the endian bracket then?
conta has joined #ruby
<baweaver>
Y'know, that's the problem when you get a good cache of Ruby knowledge
<baweaver>
ya skip the tests, then spend 20x longer manually debugging it
* baweaver
is supremely guilty of this
<havenwood>
baweaver: Yeah, that got empty strings working. Then when I added more tests I realized I'd broken compaction at some point and had to redo a bunch, hah.
<autojack>
I'm trying to create a scenario where I open a lot of files without closing the file handles, and thus trigger a "Too many open files" exception. but I'm surprised to find that Ruby seems to silently close the fd's on me to keep itself under the system limit. so Dir["./*"].each { |f| File.new(f) } doesn't error no matter how many files are in my directory. anyone know why?
<havenwood>
baweaver: I uninstalled it and reinstalled it, no error. How odd.
UncleCid__ has joined #ruby
<autojack>
(I'm trying to do this as part of a troubleshooting simulation, if you're curious)
<baweaver>
fresh install and clone. Interesting
<havenwood>
baweaver: what causes the error? tests?
<baweaver>
yep
<baweaver>
rake
<autojack>
I've set the limit for my user to 1000 and confirmed it with 'ulimit -n'
<havenwood>
baweaver: oops, test fail if gem is uninstalled because of a load path issue...
<havenwood>
baweaver: yeah, i can reproduce without gem installed
OS-35301 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
micutzu has quit [Ping timeout: 245 seconds]
anisha_ has quit [Ping timeout: 276 seconds]
Asher has joined #ruby
Mike11 has joined #ruby
GodFather has joined #ruby
OS-35301 has joined #ruby
micutzu has joined #ruby
Londino has joined #ruby
anisha_ has joined #ruby
phaul has joined #ruby
apparition has joined #ruby
herbmillerjr has quit [Quit: Konversation terminated!]
conta1 has joined #ruby
conta has quit [Ping timeout: 276 seconds]
conta1 is now known as conta
ciscam has quit [Ping timeout: 240 seconds]
ciscam has joined #ruby
agent_white has quit [Ping timeout: 256 seconds]
ellcs has quit [Ping timeout: 244 seconds]
micutzu has quit [Ping timeout: 240 seconds]
KeyJoo has joined #ruby
cschneid has joined #ruby
micutzu has joined #ruby
emilford has quit [Ping timeout: 256 seconds]
emilford has joined #ruby
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
cschneid has quit [Ping timeout: 244 seconds]
ur5us has quit [Remote host closed the connection]
wolfshappen has quit [Ping timeout: 264 seconds]
p0p0pr37_ has joined #ruby
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
p0p0pr37 has quit [Ping timeout: 260 seconds]
p0p0pr37_ is now known as p0p0pr37
wolfshappen has joined #ruby
alfiemax has quit [Remote host closed the connection]
guille-moe has quit [Ping timeout: 240 seconds]
Mike11 has quit [Quit: Leaving.]
memo1 has quit [Ping timeout: 244 seconds]
Londino has quit [Quit: Page closed]
karapety_ has joined #ruby
ramfjord has joined #ruby
guille-moe has joined #ruby
alfiemax has joined #ruby
karapetyan has quit [Ping timeout: 268 seconds]
ramfjord has quit [Ping timeout: 255 seconds]
AJA4350 has joined #ruby
Azure|dc has quit [Read error: Connection reset by peer]
Azure has joined #ruby
donofrio has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
mikecmpbll has joined #ruby
zapata has quit [Read error: Connection reset by peer]
jamesaxl has joined #ruby
zapata has joined #ruby
synthroid has joined #ruby
jottr has quit [Ping timeout: 248 seconds]
clemens3 has joined #ruby
beefjoe70 has joined #ruby
karapety_ has quit [Remote host closed the connection]
sj0rz has joined #ruby
cyberg has joined #ruby
karapetyan has joined #ruby
Londino has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
conta has quit [Client Quit]
ellcs has joined #ruby
guille-moe has quit [Ping timeout: 248 seconds]
mostlybadfly has joined #ruby
phaul has quit [Ping timeout: 244 seconds]
<Londino>
Hello guys and good morning to those of you on the other side of the pond. Although i can iterate through a table in WATIR, i can't, for the life of me, form the logic that would enable me to tick checkboxes based on whether a particular string value exists or not on the same row as each checkbox.
<Londino>
Can anyone offer me some assistance/guidance? I can supply sample HTML code if needed, although i'm pretty sure that what i'm asking is fairly common. It's just that my incompetence doesn't allow me to progress further.
Deknos has left #ruby [#ruby]
t0xik has quit [Quit: Connection closed for inactivity]
<ruby[bot]>
dminuoso: ops currently in #ruby: havenwood, Mon_Ouie, Radar, apeiros, baweaver, drbrain, jhass, miah and ruby[bot]
karapetyan has quit [Remote host closed the connection]
<stopboylovers>
oh vey shut it down!
<dminuoso>
Radar: your helpa is lying!
<apeiros>
!ban stopboylovers bye
stopboylovers was kicked from #ruby by ruby[bot] [bye]
* apeiros
should provide better ban reasons for fellow other ops :-|
<apeiros>
thx dminuoso
sphenxes has quit [Read error: Connection reset by peer]
Rapture has joined #ruby
alex`` has joined #ruby
<apeiros>
now I wonder whether I should fully read those links or whether that'll actually make me dumber…
roshanavand has joined #ruby
banisterfiend has joined #ruby
tvw has quit [Read error: Connection reset by peer]
phaul has quit [Ping timeout: 240 seconds]
ellcs has quit [Ping timeout: 248 seconds]
saTchymoto has quit []
phaul has joined #ruby
karapetyan has joined #ruby
arquebus has joined #ruby
arquebus has quit [Client Quit]
maxirater has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
apeiros: You have a paper talking about functional references, and you have a link from a troll mentioning "transgender", "feminist" and "satantic"
<dminuoso>
One makes you smarter, the other likely does not.
<apeiros>
I guess I'll continue watching this anime then. doesn't make me smarter, but it's entertaining.
banisterfiend has joined #ruby
alex`` has quit [Ping timeout: 248 seconds]
Londino has quit [Quit: Page closed]
alex`` has joined #ruby
codymj has joined #ruby
amar has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banisterfiend has joined #ruby
ciscam has quit [Ping timeout: 240 seconds]
ciscam has joined #ruby
maxirater has quit [Quit: Konversation terminated!]
guille-moe has joined #ruby
dinfuehr has quit [Ping timeout: 244 seconds]
dinfuehr has joined #ruby
GodFather has quit [Ping timeout: 268 seconds]
synthroid has quit [Remote host closed the connection]
jrafanie has joined #ruby
dionysus69 has quit [Quit: dionysus69]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banisterfiend has joined #ruby
<href>
er
yohji has quit [Ping timeout: 260 seconds]
phaul has quit [Ping timeout: 245 seconds]
yohji has joined #ruby
cadillac_ has quit [Ping timeout: 244 seconds]
cadillac_ has joined #ruby
aupadhye has quit [Ping timeout: 240 seconds]
mzo has quit [Ping timeout: 240 seconds]
stopboylovers has quit [Quit: Page closed]
banisterfiend has quit [Ping timeout: 256 seconds]
<havenwood>
derp10327: It is suspicious. Usually there's a better way than getting and setting local variables with metaprogramming.
<baweaver>
faster, more idiomatic, and doesn't need binding or eval
amar has quit [Ping timeout: 244 seconds]
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
<derp10327>
Honestly? While trying to teach myself Ruby, I'm solving fairly trivial problems. This one has gotten convoluted as I need to not only keep track of whether the method's parameter (seconds) calculated a figure for years/days/hours/minutes/seconds but also if it is a plural unit to be outputted
cyberg has quit [Ping timeout: 240 seconds]
<derp10327>
I'm sure I could use Ruby's time library but I want to teach myself how to go about using the fundamental features
<havenwood>
derp10327: Show us more code if you're interested in alternative solutions.
karapetyan has quit [Remote host closed the connection]
phaul has quit [Ping timeout: 244 seconds]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<derp10327>
So, in short, my goal is to output the string so that it contains no "0 unit(s)" and for values of 1, uses the singular form of the unit
eckhardt has joined #ruby
eckhardt has quit [Client Quit]
<derp10327>
I'll probably refactor the case statements into one-line ternaries
sagax has joined #ruby
guille-moe has quit [Ping timeout: 240 seconds]
<derp10327>
Okay, I caught the issue with putting the 2nd case statement's end too soon, but I'm still going to just use 5 ternary lines instead of all of those case statement lines
<derp10327>
Right, I mean I've got all the math working, I just need to parse it and get the output all pretty tbh
<baweaver>
divmod returns an array so you get to flatten it back down afterwards, leaving the remainder of the previous unit and the unaltered current unit
<baweaver>
If you use something like that it cuts out a huge amount of code
<baweaver>
then it's just a matter of doing something along the lines of doing pluralization for each unit
<baweaver>
you could also: seconds, minutes, hours, days, years = total_units
<baweaver>
which would give you vars with every single value
<Eiam>
those damn side effects and their... effects
<derp10327>
thanks, I'll give it a read. I just threw together a regex pattern for gsub'ing the output of the local_variable_get. It was outputting like "[x]" where I only wanted the number x to output. I'm amazed at how powerful gsub can be compared to the regex methods for other languages I've learned
mostlybadfly has quit [Quit: Connection closed for inactivity]
joast has joined #ruby
sytherax has quit [Remote host closed the connection]
<derp10327>
lol, that might be the least pointless bit of code I've done for this... I'm on the second (of three) planned conditional output snippets and I'm realizing I should've just used an each_with_index
amar_ has quit [Remote host closed the connection]
amar has joined #ruby
ldepandis has joined #ruby
clemens3 has joined #ruby
thapakazi has joined #ruby
thapakazi has quit [Client Quit]
thapakazi has joined #ruby
conta1 has quit [Ping timeout: 248 seconds]
karapetyan has quit [Remote host closed the connection]
cyberg has joined #ruby
clemens3_ has joined #ruby
cagomez has quit [Remote host closed the connection]
beefjoe70 has joined #ruby
TomyLobo has joined #ruby
karapetyan has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<derp10327>
ooh sweet, and thanks :D. Yeah when I submitted the code to the challenge website's test units and it passed them, I was able to see other user's Ruby solutions. Let me go find the one I found the most clever lol
<ruby[bot]>
havenwood: # => undefined method `yield_self' for [40, 46, 1, 13, 1970]:Array (NoMethodError) ...check link for more (https://eval.in/1013409)
<havenwood>
Ruby too old!
<havenwood>
#=> [40, 46, 1, 13, 0]
thapakazi has joined #ruby
<derp10327>
The first college I went to used fortran for their intro to programming course. I'm glad I wasn't going for a compsci major there...
<derp10327>
wait, they used ADA
<havenwood>
derp10327: Ruby was going to be called ADA 2.0.
* havenwood
lies...
AshLee has joined #ruby
<derp10327>
gross
<derp10327>
This was only a few years ago mind you lol
<dminuoso>
havenwood: Haha. I started reading ruby from the bottom right to top left.
<dminuoso>
Ive been doing too much Haskell.
<derp10327>
We already had the ability to program iOS in VS and they wanted to teach you ada
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AshLee has quit [Client Quit]
<derp10327>
I wonder how long it would've taken me to learn what I've learned about Ruby if I didn't have RubyMine at my disposal
* derp10327
thinks hard
Guest8837 has quit [Read error: Connection reset by peer]
eelster has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<gizmore>
also be astounded by what a single identity cache does
clemens3 has quit [Ping timeout: 240 seconds]
cagomez has quit [Remote host closed the connection]
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
raynold has quit []
beefjoe70 has quit [Ping timeout: 256 seconds]
ldepandis has joined #ruby
alex`` has quit [Ping timeout: 260 seconds]
grilix_ has joined #ruby
Jiaoyin has quit [Quit: Page closed]
dreamthese has quit [Ping timeout: 245 seconds]
dreamthese has joined #ruby
mtkd has quit []
grilix has quit [Ping timeout: 260 seconds]
Guest53857 has quit [Ping timeout: 268 seconds]
tectonic has joined #ruby
alex`` has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
mtkd has joined #ruby
cyberg has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
karapetyan has left #ruby [#ruby]
fullstack_ has quit [Ping timeout: 256 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
fullstack_ has joined #ruby
sytherax has joined #ruby
fmcgeough_ has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
fmcgeough has quit [Ping timeout: 244 seconds]
fmcgeough_ is now known as fmcgeough
tdy has quit [Ping timeout: 240 seconds]
NingaLeaf has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mostlybadfly has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
VladGh has joined #ruby
ams__ has quit [Quit: Connection closed for inactivity]
phaul has joined #ruby
jenrzzz has joined #ruby
orbyt_ has joined #ruby
rfoust has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has joined #ruby
Mike11 has quit [Quit: Leaving.]
synthroid has quit [Remote host closed the connection]
fmcgeough has quit [Quit: fmcgeough]
Dark_Arc has quit [Ping timeout: 240 seconds]
synthroid has joined #ruby
za1b1tsu has joined #ruby
anisha__ has joined #ruby
anisha_ has quit [Read error: Connection reset by peer]
rkazak has joined #ruby
<gizmore>
it is scary that here are almost no questions..... ruby is scarily solid? ;)
<gizmore>
is there a #ruby-chat?
eckhardt has joined #ruby
t0xik has joined #ruby
<gizmore>
havenwood: hi .... i would like to explain my framework to you. it will show rails and laravel to their place when it comes to handle data and requests in even more protocols
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 256 seconds]
TomyLobo has quit [Ping timeout: 260 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
mikecmpbll has joined #ruby
tomphp has joined #ruby
cyberg has joined #ruby
tomphp has quit [Client Quit]
tomphp has joined #ruby
tomphp has quit [Client Quit]
tomphp has joined #ruby
tomphp has quit [Client Quit]
alex`` has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
tomphp has joined #ruby
tomphp has quit [Client Quit]
ramfjord has quit [Ping timeout: 268 seconds]
tomphp has joined #ruby
al2o3-cr has quit [Ping timeout: 240 seconds]
arkinor has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has quit [Client Quit]
gr33n7007h is now known as al2o3-cr
amar has joined #ruby
DLSteve_ has quit [Quit: All rise, the honorable DLSteve has left the channel.]
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
roshanavand has joined #ruby
armyriad has quit [Ping timeout: 268 seconds]
amar has quit [Ping timeout: 244 seconds]
<Radar>
derp10327: wat
<derp10327>
Well, using ruby on rails for web dev makes the whole process fast, or "on rails". but saying that Ruby is the thing "on rails" implies it makes writing ruby faster...