drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drale2k_ has joined #ruby
solocshaw has quit [Ping timeout: 246 seconds]
kankava has quit [Quit: leaving]
RougeR has joined #ruby
ramfjord has quit [Ping timeout: 250 seconds]
cd has quit [Quit: cd]
mn3m has quit [Ping timeout: 268 seconds]
DarthGandalf has quit [Quit: Bye]
ramfjord has joined #ruby
solocshaw has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RougeR has quit [Remote host closed the connection]
RougeR has joined #ruby
sameerynho has quit [Ping timeout: 268 seconds]
impermanence has joined #ruby
zenogais has joined #ruby
<zenogais>
Hey all! Random extension gem question I was hoping someone might know the answer to. Right now I'm using `rb_eval_string("SecureRandom.random_bytes(32)");` in an extension gem to get 32 bytes of random data. I'd rather just get the `VALUE` of the `SecureRandom` object and make an `rb_funcall` on it. Is there a built-in way to get an object by name in C extensions? I've tried quite a few things but wasn't able to figure it out.
davidw has quit [Ping timeout: 258 seconds]
conta has joined #ruby
SuperLag has quit [Remote host closed the connection]
r29v has quit [Quit: r29v]
marmotini has joined #ruby
solocshaw1 has joined #ruby
solocshaw has quit [Ping timeout: 240 seconds]
solocshaw1 is now known as solocshaw
conta has quit [Ping timeout: 250 seconds]
marmotini has quit [Ping timeout: 246 seconds]
solocshaw has quit [Remote host closed the connection]
zcarey has joined #ruby
DarthGandalf has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
<hays>
baweaver: where is the line with metaprogramming
lupine has quit [Ping timeout: 250 seconds]
<baweaver>
In some cases I'd be tempted to say if you don't know where that line is it's probably not a great idea to use it.
<baweaver>
Though I'd also argue that people seriously overload that word as well
<baweaver>
and a lot of the ideas that are dubbed as metaprogramming really aren't
<hays>
maybe im using it and i dont know it
<baweaver>
If you're using Rails you probably are in some capacity, though they tend to move away from it more as time goes on for speed and stability reasons
<baweaver>
find_by_name_and_email type methods don't really exist anymore in favor of keyword / query type methods
<hays>
what if i was writing something ike roda where i define a class capable of doing the route do end stuff
<baweaver>
Not really metaprogramming.
<baweaver>
That's just making a DSL using functions
<baweaver>
Hence mentioning above that the term is quite overloaded and we tend to call a lot of things metaprogramming when they really aren't
<baweaver>
That, and I think there's this mentality to call things dirty, ugly, or hacky whenever they're a perfectly normal part of the language
<hays>
yeah i think its one thing truly unique about ruby that it basically got from smalltalk
<baweaver>
I just see there being no good reason to use a chainsaw to trim a bonsai tree when there are hedge clippers within reach.
<hays>
unique in the sense if you look at other popular modern languages
d10n-work has quit [Quit: Connection closed for inactivity]
<baweaver>
Use the least powerful tool to do the task you need, less likely to behave oddly later
<hays>
i like D. Thomas' distinction between class oriented programming and OOP
<baweaver>
Like I could write any and all Enumerable functions using reduce, but I rarely use it like that. I'd use the actual functions instead.
crankharder has quit [Ping timeout: 258 seconds]
<hays>
yeah, makes sense although it might be hard to formalize that heristic
davidw has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
zcarey has quit [Ping timeout: 250 seconds]
<baweaver>
My common rule is that if I have to ask or think about something being appropriate I probably shouldn't do something
Nicmavr has quit [Read error: Connection reset by peer]
<baweaver>
That applies to programming, life, and other bits as well.
<lunarkittychan>
ooh, github private repos are now free
<baweaver>
ohai lunarkittychan
<lunarkittychan>
hai
lupine has joined #ruby
uplime has joined #ruby
Nicmavr has joined #ruby
<hays>
lunarkittychan: really??
<hays>
like.. can you share them?
davidw has quit [Ping timeout: 258 seconds]
<hays>
three collaborators... nice
<hays>
i dunno. i don't trust microsoft
<hays>
but it seems people aren't really rushing off the platform
davidw has joined #ruby
<lunarkittychan>
hays: I didn't look into the details yet
SeepingN has quit [Quit: The system is going down for reboot NOW!]
r29v has joined #ruby
Davey is now known as D[a]vey
D[a]vey is now known as Davey
Davey is now known as D[a]vey
D[a]vey is now known as Davey
RedNifre has quit [Ping timeout: 252 seconds]
stryek has quit [Quit: Connection closed for inactivity]
davidw has quit [Ping timeout: 244 seconds]
xall has joined #ruby
rkazak has joined #ruby
tiff has joined #ruby
gix has quit [Ping timeout: 246 seconds]
ramfjord has quit [Read error: Connection reset by peer]
r29v has quit [Quit: r29v]
mikecmpbll has quit [Quit: inabit. zz.]
ramfjord has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maryo_ has joined #ruby
raulp has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Swyper>
I need to write a method to pass these tests
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Swyper>
eval_block(*args) do |*args|
<Swyper>
end
<Swyper>
is this the correct way to write a method with splat?
<Swyper>
havenwood, if your on
tdy has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
rkazak has joined #ruby
davidw has joined #ruby
tdy has quit [Ping timeout: 246 seconds]
braincrash has quit [Quit: bye bye]
akem has quit [Quit: Leaving]
braincrash has joined #ruby
d10n-work has joined #ruby
tdy has joined #ruby
akem has joined #ruby
marmotini has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
ur5us has quit [Remote host closed the connection]
za1b1tsu has joined #ruby
millerti has quit [Ping timeout: 246 seconds]
hell0h0la has joined #ruby
sauvin has joined #ruby
Swyper has quit [Remote host closed the connection]
sanscoeur has joined #ruby
dellavg_ has joined #ruby
davidw has quit [Ping timeout: 268 seconds]
marmotini has quit [Ping timeout: 258 seconds]
tdy has joined #ruby
davidw has joined #ruby
Azure has quit [Read error: Connection reset by peer]
hutch has quit [Ping timeout: 245 seconds]
Azure has joined #ruby
d10n-work has quit [Ping timeout: 252 seconds]
hutch has joined #ruby
d10n-work has joined #ruby
Sina has quit [Quit: Connection closed for inactivity]
hell0h0la has left #ruby ["Leaving of your life"]
davidw has quit [Ping timeout: 250 seconds]
xall has quit [Ping timeout: 245 seconds]
<hays>
if I make an accessor with attr_accessor, why would i need to access it with self.accessor
<hays>
seems like without the self. it doesn't actually assign but treats it like a local var
xall has joined #ruby
marmotini has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
xall has quit [Ping timeout: 245 seconds]
zenogais has quit [Ping timeout: 246 seconds]
<hays>
i guess its ambiguous
hovis has quit [Ping timeout: 268 seconds]
rkazak has joined #ruby
xall has joined #ruby
Guest86938 has joined #ruby
ogres has quit [Quit: Connection closed for inactivity]
<baweaver>
With += yeah, it does bad things
<baweaver>
I still don't agree with it treating it as a local variable in that context honestly
xall has quit [Ping timeout: 246 seconds]
xall has joined #ruby
dellavg_ has quit [Ping timeout: 250 seconds]
hutch has quit [Ping timeout: 244 seconds]
za1b1tsu has quit [Remote host closed the connection]
za1b1tsu has joined #ruby
ramfjord has joined #ruby
reber has joined #ruby
xall has quit [Ping timeout: 268 seconds]
ramfjord has quit [Ping timeout: 244 seconds]
tdy has quit [Ping timeout: 272 seconds]
conta has joined #ruby
gix has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
d10n-work has quit [Quit: Connection closed for inactivity]
dionysus69 has joined #ruby
Guest86938 has quit [Ping timeout: 252 seconds]
rkazak has quit [Quit: Sleep.....ing....]
Guest86938 has joined #ruby
phredus_ has joined #ruby
mn3m has joined #ruby
phredus__ has joined #ruby
phredus_ has left #ruby ["Leaving"]
phredus__ has quit [Client Quit]
phredus_ has joined #ruby
Guest86938 has quit [Ping timeout: 252 seconds]
aupadhye has joined #ruby
sqbell has joined #ruby
themsay has joined #ruby
gix has quit [Ping timeout: 250 seconds]
sqbell has quit [Ping timeout: 250 seconds]
zululee_ has joined #ruby
olspookishmagus has joined #ruby
sqbell has joined #ruby
alem0lars has joined #ruby
rippa has joined #ruby
tiff has joined #ruby
themsay has quit [Ping timeout: 240 seconds]
Inline has quit [Quit: Leaving]
cnsvc has joined #ruby
za1b1tsu has joined #ruby
moei has joined #ruby
Sina has joined #ruby
mn3m has quit [Quit: mn3m]
dionysus69 has quit [Ping timeout: 258 seconds]
alem0lars has quit [Ping timeout: 252 seconds]
beaky has quit [Read error: Connection reset by peer]
clemens3 has joined #ruby
beaky has joined #ruby
alem0lars has joined #ruby
priodev has joined #ruby
dkmueller has quit [Quit: Lost terminal]
armyriad has quit [Read error: Connection reset by peer]
armyriad has joined #ruby
hays has quit [Ping timeout: 244 seconds]
hays has joined #ruby
uplime has quit [Quit: WeeChat 2.2]
sqbell has quit [Ping timeout: 250 seconds]
themsay has joined #ruby
arcaos has joined #ruby
aufi has joined #ruby
arcaos has quit [Remote host closed the connection]
cnsvc has quit [Remote host closed the connection]
vondruch has quit [Ping timeout: 268 seconds]
themsay has quit [Ping timeout: 244 seconds]
cthulchu_ has quit [Ping timeout: 250 seconds]
aufi_ has joined #ruby
aufi has quit [Ping timeout: 244 seconds]
RougeR has quit [Ping timeout: 272 seconds]
vondruch has joined #ruby
Bish has quit [Quit: leaving]
ansraliant has quit [Quit: My planet needs me]
mikecmpbll has joined #ruby
xall has joined #ruby
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drale2k_ has joined #ruby
xall has quit [Quit: xall]
maufart__ has joined #ruby
aufi_ has quit [Ping timeout: 258 seconds]
scatterp has joined #ruby
<scatterp>
hi i updated from ruby 2.5.1 to ruby 2.6.0 and I am getting this error TypeError (wrong argument type Hash (expected String)): app/controllers/application_controller.rb:208:in `set_gon' can any one tell me whats wrong here gem files are all the same
Guest86938 has joined #ruby
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<scatterp>
phaul: i am currently testing upgrading 1 ruby version at a time 2.5.3 did not have the error any other suggestions that I could try ?
<phaul>
I would start by verifying that the call in question is inject({}). Pass a different argument like [] instead of {} and check that the error msg changes.
<scatterp>
phaul: ok one moment
<phaul>
this time it should complain wrong argument type Array (expected String)
lxsameer has quit [Quit: WeeChat 2.3]
lxsameer has joined #ruby
<scatterp>
phaul: TypeError (wrong argument type Hash (expected String))
<phaul>
hm. so it's probably not even that call. this is going to be very difficult to debug over IRC unfortunately
Puffball has joined #ruby
<phaul>
are you familiar with pry and or byebug?
<scatterp>
byebug is in the gemfile not completely familiar with it
apparition has joined #ruby
comet23 has quit [Quit: Connection closed for inactivity]
<scatterp>
i have a suspicion the problem is due to activerecord version (needs updating)
<phaul>
stick a require 'byebug' at the top of the file and a single line that just says byebug on line 207
<phaul>
re-running the app should stop at a byebug prompt, where you can inspect the variables inside that method.
<scatterp>
phaul: I also see this warning (/home/deploy/peatio/current/vendor/bundle/ruby/2.6.0/gems/activesupport-4.2.10/lib/active_support/core_ext/object/duplicable.rb:111: warning: BigDecimal.new is deprecated; use BigDecimal() method instead.)
<phaul>
yeah, as you said activerecord 4.2.10 might be now incompatible
Guest86938 has quit [Ping timeout: 252 seconds]
<phaul>
I think it comes from frame 4 in your backtrace, where the mysql2 adapter calls the old interface on BigDecimal
<scatterp>
phaul: its a thought but we are no where near your skill level...
<scatterp>
yes thats what we was looking at
<phaul>
at byebug prompt you can zoom on any part of the backtrace with the fr command.
<scatterp>
phaul: i tried changing all bigdecimals to bigdecimal() the warning went away but still the same error..
conta has quit [Quit: conta]
blackmesa has quit [Quit: WeeChat 2.3]
<phaul>
check frame 4 from the backtrace. when byebug is stopped at the exception ( the point when you did bt command) do frame 4.
<phaul>
hm. that's not it. I meant this location home/deploy/peatio/current/vendor/bundle/ruby/2.6.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/mysql2_adapter.rb:222
<phaul>
but it feels first you should upgrade active_record, and see where that takes you.. you can also ask #RubyOnRails if they know about such incompatibility.
Nicmavr has quit [Read error: Connection reset by peer]
<al2o3-cr>
^ phaul
<al2o3-cr>
lol
<phaul>
al2o3-cr: hi there
<al2o3-cr>
hello, phaul :)
<phaul>
pff. your fiddling capabilities are way beyond me :) I wonder if there is a limit to what you can do
Nicmavr has joined #ruby
<al2o3-cr>
the possibilities are endless :P
za1b1tsu has quit [Remote host closed the connection]
za1b1tsu has joined #ruby
Linuus_ has joined #ruby
vonfry has quit [Quit: WeeChat 2.3]
<Linuus_>
I have a rails project where we use rspec. Some specs doesn't need all of rails to run so we just require our spec_helper (instead of the rails_helper) and require the file we need for the tests in that file. Now, when we I'm running the entire test suite I get a lot of warnings about constants being re-initialized. This is (I AFAICT) because the same file is loaded multiple times. Adding ||= to all constant assignments solves the iss
<Linuus_>
Any better ideas?
<Linuus_>
For instance, if a file contains class Foo; Bar = "OMG".freeze; end I will get the warning "Bar is already initialized bla bla"
<Swyper>
so I could do something like args.each { bloc } and that should give me what I want?
<Swyper>
what I want is to pass this test cases >_>
ramfjord has joined #ruby
<phaul>
no
<phaul>
yield_with_args checks if it yields the args in one go. 3 args one time, not 1 arg 3 times
ramfjord has quit [Ping timeout: 246 seconds]
<phaul>
the only thing that's suspect to me with the implementation on the paste is the double *args, one shadowing the other
<phaul>
well, scratch that, there are other issues
<Swyper>
if block_given?
<Swyper>
yield_with_args
<Swyper>
else
<Swyper>
this also does not work :p
<phaul>
on the paste it's a mixture of definition of the method and a call to a method. when you define a method use the def keyword. Also in the definition you don't pass a block. you will pass the block when the method is called
<phaul>
def eval_block(*args, &block) ; ... implementation body comes here .. ; end
<phaul>
there is no def eval_block(...) do
<Swyper>
NameError: undefined local variable or method `args' for main:Object
<Swyper>
al2o3-cr: App Academy released their online curriculum for free their a top bootcamp so I'm following it
<Swyper>
I'm a computer science student @ York U in Canada so I figure if its good enough to get people full time jobs at the very least it will help me get a decent internship xD
<al2o3-cr>
Swyper: go for it then and good luck ;)
<Swyper>
thank you
Rapture has joined #ruby
Guest86938 has quit [Quit: Konversation terminated!]
<Swyper>
I get how bubble sort works and that I need to compare two elements the only issue I'm having is how do I reference an array that has not been created?
sanscoeur has quit [Remote host closed the connection]
knight33 has quit [Remote host closed the connection]
sanscoeur has joined #ruby
aupadhye|brb has quit [Remote host closed the connection]
<phaul>
you have the full array interface at your displosal. #length, #[]
GodFather has joined #ruby
sanscoeur has quit [Remote host closed the connection]
<phaul>
in an instance method length will just give you the length. self[3] will give you the elem under index 3
sanscoeur has joined #ruby
<phaul>
but you can be explicit and also say self.length
conta1 has quit [Ping timeout: 272 seconds]
sanscoeur has quit [Remote host closed the connection]
TheBloke has joined #ruby
<Swyper>
so maybe use this.length? I should mention at this point in the cirriculum I have not studied classes at all - so I can come back to this later if you think I'm not ready for this :P
<Swyper>
ah
sanscoeur has joined #ruby
dinfuehr has quit [Ping timeout: 258 seconds]
<phaul>
methods without explicit receiver are always sent to self. you can ommit self, but writing self.method also works
sanscoeur has quit [Remote host closed the connection]
<phaul>
there are cases when you have to spell out self.. for instance #class would be taken as the class keyword, not the class method.
sanscoeur has joined #ruby
sanscoeur has quit [Remote host closed the connection]
dinfuehr has joined #ruby
chouhoulis has joined #ruby
dinfuehr_ has joined #ruby
GodFather has quit [Ping timeout: 268 seconds]
sanscoeur has joined #ruby
sanscoeur has quit [Read error: Connection reset by peer]
scrptktty has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
dinfuehr_ has quit [Ping timeout: 268 seconds]
d10n-work has joined #ruby
<NL3limin4t0r_afk>
Another one is when using the square brackets. `[1]` simply creates an new array in void context, whereas `self[1]` uses the [] accessor.
GodFather has joined #ruby
maufart__ has quit [Ping timeout: 245 seconds]
NL3limin4t0r_afk is now known as NL3limin4t0r
r29v has joined #ruby
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #ruby
dinfuehr has quit [Ping timeout: 245 seconds]
cthulchu_ has joined #ruby
GodFather has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
GodFather has joined #ruby
Inline has quit [Read error: Connection reset by peer]
Inline has joined #ruby
dinfuehr has quit [Ping timeout: 246 seconds]
Inline has quit [Read error: Connection reset by peer]
Inline has joined #ruby
dinfuehr has joined #ruby
davidw has joined #ruby
Swyper has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 246 seconds]
za1b1tsu has quit [Remote host closed the connection]
cthulchu_ has quit [Ping timeout: 250 seconds]
cthulchu_ has joined #ruby
r29v has quit [Quit: r29v]
dinfuehr has joined #ruby
GodFather has quit [Ping timeout: 252 seconds]
Aqo has joined #ruby
unreal has joined #ruby
ams__ has joined #ruby
dinfuehr has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
bga57 has quit [Ping timeout: 240 seconds]
clemens3 has quit [Ping timeout: 240 seconds]
dinfuehr has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
zapata has quit [Read error: Connection reset by peer]
zapata has joined #ruby
GodFather has joined #ruby
duderonomy has quit [Ping timeout: 272 seconds]
\void has joined #ruby
tdy has joined #ruby
catbusters has joined #ruby
duderonomy has joined #ruby
hiroaki has joined #ruby
patteh has quit [Remote host closed the connection]
dinfuehr has quit [Ping timeout: 258 seconds]
hutch has joined #ruby
dinfuehr_ has joined #ruby
uplime has quit [Ping timeout: 244 seconds]
duderono_ has joined #ruby
duderonomy has quit [Ping timeout: 258 seconds]
uplime has joined #ruby
tdy has quit [Ping timeout: 272 seconds]
r29v has joined #ruby
tdy has joined #ruby
za1b1tsu has joined #ruby
Swyper has joined #ruby
<za1b1tsu>
Stupid question, why do I add my gems dependencies in gemspec? Why not directly into the gemfile? What is the difference?
<za1b1tsu>
Or better yet, what is the logic?
<za1b1tsu>
I think that is my actual question
Swyper has quit [Ping timeout: 250 seconds]
mikecmpbll has quit [Ping timeout: 246 seconds]
orbyt_ has joined #ruby
thunderbirdtr has quit [Quit: ZNC 1.7.1 - https://znc.in]
<canton7>
long story short: bundler/gemfile is for locking down the exact versions of gems that your application uses. gemspec is used when creating a gem, is used tell consumers what gems your library depends on, and you specify lax ranges rather than specific versions
Swyper has quit [Remote host closed the connection]
maryo has joined #ruby
Swyper has joined #ruby
dinfuehr_ has quit [Ping timeout: 246 seconds]
dinfuehr has joined #ruby
clemens3 has joined #ruby
lxsameer has quit [Ping timeout: 250 seconds]
dinfuehr has quit [Ping timeout: 246 seconds]
Swyper has quit [Remote host closed the connection]
sanscoeur has joined #ruby
dinfuehr has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
sauvin has quit [Read error: Connection reset by peer]
dinfuehr has joined #ruby
sanscoeu_ has joined #ruby
marmotini_ has joined #ruby
dinfuehr has quit [Ping timeout: 245 seconds]
<havenwood>
za1b1tsu: What canton7 said. Gems in the gemspec are deps, and are installed alongside a gem. A Gemfile in a gem is for contributors to the gem, and often just has a `gemspec` directive - meaning install the gems in the gemspec. With gems, unlike apps, you don't commit the Gemfile.lock.
FastJack has quit [Remote host closed the connection]