<Obats>
Ah. Nice :). Not sure I understand all of it though. Is the &>> required? Or is it for the bot here?
<Bish>
it's just so the bot knows "here comes ruby code"
<Bish>
so &>> isn't a part of ruby
<Bish>
it's designed to look like the begin of a repl
sylario has joined #ruby
fphilipe has quit [Ping timeout: 244 seconds]
fphilipe has joined #ruby
<Obats>
I don't get it. When I do file.puts ctx[:subscr] I get {:title=>"", :results=>[{:ad_image_url=>"https... Shouldn't it be possible to do ctx[:subscr][:results].each ? I get Unknown error (class: TypeError): no implicit conversion of Symbol into Integer
<Obats>
('[' in Ruby means Array, right?)
<ytti>
as far as i can see, basd on what you tell, this should work
<ytti>
perhaps write simple example of failing code in some playground
<ytti>
the error implies you are actually accessing Array, not Hash
<ytti>
so could it be you're omitting that :subscr actually contains an array?
<ytti>
perhaps you need ctx[:subscr].first[:results]
Abhijit has joined #ruby
<Abhijit>
Hi
<Abhijit>
how can I kill ruby script using ctrl + c when this script is waiting for user input on gets.chomp?
<ytti>
that should work
<ytti>
unless you trap it and handle it
<Abhijit>
but when script is on gets.chomp line it won't proceed unless input is entered?
<ytti>
if you press ctrl+c it should just abort the execution of the rugby
<ytti>
ruby also
<ytti>
sometimes rugby
<ytti>
do you want to abort reading user input and continue executing the ruby?
<Abhijit>
no. complete exit.
<Abhijit>
i got one reference from one SE page! it works now.
howdoi has joined #ruby
<ytti>
it should work without doing anything :>
bijan_ has joined #ruby
queip has quit [Ping timeout: 272 seconds]
stan has quit [Ping timeout: 244 seconds]
Freshnuts has quit [Quit: Leaving]
queip has joined #ruby
bitwinery has quit [Ping timeout: 244 seconds]
DTZUZO has joined #ruby
jenrzzz has joined #ruby
absolutejam2 has quit [Ping timeout: 245 seconds]
Obats has quit [Ping timeout: 260 seconds]
za1b1tsu has quit [Remote host closed the connection]
absolutejam2 has joined #ruby
<m17>
Either the script was trapping the exit signal or something else was trapping it :D
AndreYuhaii has quit [Quit: Leaving]
bijan_ has quit [Remote host closed the connection]
bijan_ has joined #ruby
bijan_ has quit [Remote host closed the connection]
akem-lnvo has quit [Ping timeout: 246 seconds]
queip has quit [Ping timeout: 244 seconds]
andikr has quit [Ping timeout: 245 seconds]
bijan_ has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
rokra has quit [Ping timeout: 268 seconds]
fphilipe has quit [Ping timeout: 245 seconds]
queip has joined #ruby
bijan_ has quit [Remote host closed the connection]
bijan_ has joined #ruby
fphilipe has joined #ruby
bijan_ has quit [Remote host closed the connection]
bijan_ has joined #ruby
bijan_ has quit [Remote host closed the connection]
Abhijit_ has joined #ruby
bijan_ has joined #ruby
andikr has joined #ruby
bijan_ has quit [Remote host closed the connection]
Abhijit has quit [Ping timeout: 245 seconds]
bijan_ has joined #ruby
Ring0` has joined #ruby
<Ring0`>
Hi. I'm trying to get my head around enumerators (generators?) and I tried to yield numbers in a loop and put them into an array by appending them on each iteration, however I can't figure out how to include an object into the block. What I've tried: https://wandbox.org/permlink/xMui0GR7Qk0gXf4g
<voker57>
I'd have a look at your link but it does not work without js, please paste to https://dpaste.de
<voker57>
with_object is a method of Enumerator, you are calling it on a result of calling foo
drnerdius has quit [Quit: Konversation terminated!]
drnerdius has joined #ruby
drnerdius has quit [Client Quit]
drnerdius has joined #ruby
drnerdius has quit [Client Quit]
drnerdius has joined #ruby
<voker57>
i'm not sure what you are trying to accomplish with this code
<Ring0`>
The result should be the same as if I did (0..5).to_a, but since I'm trying to understand how yielding works, I create some overengineered scenarios like this one here
andikr has quit [Remote host closed the connection]
<Ring0`>
so having a method that returns multiple values, I would like to yield them there and immediatelly wrap in an array, without having to declare empty array before calling foo
<Ring0`>
tacit-style :)
gregf_ has quit [Remote host closed the connection]
<voker57>
if you yield, further transformations are difficult
<voker57>
coz you have to supply block directly to that method
<Ring0`>
Hmm.. and this block cannot really provide any additional arguments to the block? Darn. The example you returned is obviously OK, but assume such scenario: https://dpaste.de/Qqqc
fphilipe has quit [Ping timeout: 248 seconds]
<Ring0`>
As I see it, declaring an empty array, appending during iteration and then returning it seems inevitable providing that I insist on using yield
bijan_ has quit [Remote host closed the connection]
fphilipe has joined #ruby
bijan_ has joined #ruby
<Ring0`>
which in such case I could just return the array as-is
bijan_ has quit [Remote host closed the connection]
bijan_ has joined #ruby
bijan_ has quit [Remote host closed the connection]
jenrzzz has joined #ruby
<leftylink>
`foo.whatever` acts on whatever `foo` returned. whereas `foo { some_block }` gives a block to `foo`, which `foo` might or might not choose to `yield` things to. expecting `whatever` to be able to affect `some_block` before `foo` can `yield` to it seems to imply time travel
bijan_ has joined #ruby
<leftylink>
if it must be a one-liner (well, I'm not going to judge, maybe there is a code golf contest going on, or maybe the widescreen monitor is broken and there's just 1 very very long line and you wouldn't be able to see the program if it was on two lines)
<leftylink>
then I guess you can do some shit with ||=
<leftylink>
we'll ignore the fact that you would get yelled at if you actually wrote that code in a code review
<leftylink>
excuse my bad language
<leftylink>
the thought of the code I was about to write to demonstrate got me putting too low effort into my words
x0f has quit [Ping timeout: 250 seconds]
<ZAJDAN>
do sombody has experiences mine data from SAP B1 ...?
<Ring0`>
Thought about that one :)) I'm working in PHP on every day basis so you must understand my thrive for one-liners. I have to maintain the balance between writing abominable at work and relaxing oneliners at home
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has joined #ruby
<brahmana>
voker57 : Thank you. Sadly that is a recent feature and I am currently stuck on an older version of Ruby.. :-)
bijan_ has joined #ruby
Abhijit_ has quit [Quit: Leaving]
Inline has joined #ruby
jenrzzz has joined #ruby
Swyper has joined #ruby
DTZUZO has quit [Ping timeout: 258 seconds]
SidepocketNeo has quit [Remote host closed the connection]
SidepocketNeo has joined #ruby
cd has joined #ruby
chalkmonster has joined #ruby
brahmana has quit [Ping timeout: 260 seconds]
ogres has joined #ruby
bijan_ has quit [Ping timeout: 264 seconds]
jcalla has joined #ruby
QCF has joined #ruby
QCF has quit [Client Quit]
jenrzzz has quit [Ping timeout: 258 seconds]
DTZUZO has joined #ruby
bijan_ has joined #ruby
DTZUZO has quit [Ping timeout: 244 seconds]
fphilipe has quit [Ping timeout: 248 seconds]
involans has joined #ruby
Snowy has joined #ruby
involans has quit [Read error: Connection reset by peer]
TomyWork has quit [Remote host closed the connection]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
Swyper has quit [Remote host closed the connection]
jefffrails35 has joined #ruby
fphilipe has joined #ruby
schne1der has quit [Ping timeout: 245 seconds]
deepreds1 has quit [Ping timeout: 245 seconds]
Dr_MDMA_MD has joined #ruby
jenrzzz has joined #ruby
BH23 has joined #ruby
Esa_ has joined #ruby
matheusmoreira has quit [Remote host closed the connection]
matheusmoreira has joined #ruby
themsay has quit [Read error: Connection reset by peer]
themsay has joined #ruby
bijan_ has quit [Remote host closed the connection]
bijan_ has joined #ruby
fphilipe has quit [Ping timeout: 258 seconds]
schne1der has joined #ruby
bijan_ has quit [Ping timeout: 250 seconds]
lucasb has joined #ruby
absolutejam2 has quit [Read error: Connection reset by peer]
absolutejam2 has joined #ruby
leitz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
milkohol has joined #ruby
awebdev has joined #ruby
absolutejam2 has quit [Ping timeout: 245 seconds]
awebdev has quit [Ping timeout: 248 seconds]
drnerdius has quit [Ping timeout: 258 seconds]
BH23 has quit [Ping timeout: 248 seconds]
bijan_ has joined #ruby
skryking has joined #ruby
face has joined #ruby
facest has quit [Ping timeout: 245 seconds]
mynameisdebian has joined #ruby
Fraeon has quit [Remote host closed the connection]
noobineer has quit [Ping timeout: 250 seconds]
DaRock has quit [Ping timeout: 246 seconds]
bijan_ has quit [Remote host closed the connection]
bijan_ has joined #ruby
englishm has quit [Excess Flood]
englishm has joined #ruby
englishm has quit [Excess Flood]
englishm has joined #ruby
englishm has quit [Excess Flood]
aupadhye has quit [Remote host closed the connection]
englishm has joined #ruby
englishm has quit [Excess Flood]
noobineer has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
englishm has joined #ruby
mynameisdebian has quit [Ping timeout: 244 seconds]
bijan_ has quit []
SeepingN has joined #ruby
oetjenj has joined #ruby
Technodrome has joined #ruby
henninb has joined #ruby
troulouliou_div2 has quit [Remote host closed the connection]
teardown has quit [Ping timeout: 258 seconds]
jefffrails35 has quit [Quit: Leaving]
ixti has joined #ruby
ellcs has quit [Remote host closed the connection]
ogres has quit [Quit: Connection closed for inactivity]
madprogrammer has joined #ruby
fphilipe has joined #ruby
henninb has quit [Quit: leaving]
chamunks has quit [Ping timeout: 246 seconds]
tdy has joined #ruby
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
orbyt_ has joined #ruby
jenrzzz has joined #ruby
chamunks has joined #ruby
BH23 has joined #ruby
Snowy has quit [Remote host closed the connection]
henninb has joined #ruby
fphilipe has quit [Ping timeout: 245 seconds]
duderonomy has joined #ruby
ramfjord has joined #ruby
jenrzzz has quit [Ping timeout: 258 seconds]
lxsameer has quit [Quit: out]
ixti has quit [Ping timeout: 245 seconds]
BH23 has quit [Ping timeout: 246 seconds]
rafadc_ has joined #ruby
rafadc has quit [Ping timeout: 246 seconds]
fphilipe has joined #ruby
themsay has quit [Read error: Connection reset by peer]
henninb has quit [Quit: leaving]
themsay has joined #ruby
Dr_MDMA_MD has quit []
ua_ has quit [Ping timeout: 244 seconds]
themsay has quit [Ping timeout: 268 seconds]
themsay has joined #ruby
absolutejam2 has joined #ruby
mkaito has left #ruby ["WeeChat 2.5"]
georgie has joined #ruby
Snowy has joined #ruby
georgie has quit [Client Quit]
themsay has quit [Ping timeout: 248 seconds]
involans has joined #ruby
Dr_MDMA_MD has joined #ruby
fphilipe has quit [Ping timeout: 245 seconds]
ixti has joined #ruby
sauvin has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
xco has quit [Quit: xco]
jtdowney has quit [Quit: jtdowney]
jtdowney has joined #ruby
ua has joined #ruby
Snowy has quit [Ping timeout: 246 seconds]
themsay has joined #ruby
mlt- has joined #ruby
<mlt->
Hi! Noob is here. I'm trying to prepend a module to wrap a method, but my wrapper does not get called. Any suggestion? https://dpaste.de/0EmL
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
sameerynho has joined #ruby
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
<havenwood>
mlt-: You're equivocating between include/included and prepend/prepended, which are different things.
<havenwood>
mlt-: Do you want to include or prepend it?
<mlt->
havenwood: I just resolved the issue... I had to prepend to another class which in turn includes what I had initially
<mlt->
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include SchemaAwareness did the trick
<havenwood>
mlt-: `self.included(mod)` or `ReferentialIntegrity.prepend`
<havenwood>
mlt-: Ah
duckpuppy has joined #ruby
alem0lars has joined #ruby
xco has joined #ruby
amrx has joined #ruby
involans has quit [Quit: involans]
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
teardown has joined #ruby
<jidar>
is there a Regexp append of some sort, like I want to match on a list of items? I saw it mentioned here a while back but grep/search is failing me
amrx has quit [Ping timeout: 244 seconds]
<leftylink>
is that Regexp.union ?
<jidar>
yea I think so
<jidar>
let me try it out
tdy has quit [Remote host closed the connection]
madprogrammer has quit [Remote host closed the connection]
Snowy has joined #ruby
gix has joined #ruby
Snowy has quit [Read error: Connection reset by peer]
Snowy has joined #ruby
oetjenj has joined #ruby
Snowy has quit [Ping timeout: 248 seconds]
jenrzzz has quit [Ping timeout: 245 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
vjacob has joined #ruby
<jidar>
leftylink:yep, worked. Thanks!
involans has joined #ruby
ramfjord has quit [Ping timeout: 248 seconds]
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zave has joined #ruby
<zave>
hi all, is this a good place to ask a question about installing and compiling ruby with rbenv/ruby-build?
<Eiam>
zave: ask yer question
guest6788 has joined #ruby
glosoli has joined #ruby
<glosoli>
Hey, any reasons why would anyone prefer doing `gem install rake` vs `bundle install rake` ?
skryking has quit [Quit: WeeChat 2.4]
<zave>
Eiam: thank you, i'm using them both on a server that is offline, no internet connection, that is...so i've scp'd and uncompressed a tar file to ~/.rbenv/cache and am attempting to do 'rbenv install 2.5.1', but i'm getting an error that starts with what appears to be an attempt to find the ruby on the internet.
<Eiam>
glosoli: yes those are totally different commands? =0
<Eiam>
glosoli: in one, you are using your bundle file to manage the dependencies and in the other you are just installing a gem
<glosoli>
Eiam sorry just getting started with ruby, kind of confused about the right ways to install dependencies, it seems one can just edit Gemfile and run bundle install
<zave>
so how do i force ruby-build / rbenv to install and compile the ruby i have in ~/.rbenv/cache?
<glosoli>
just installing gem means adding it to the ruby level deps ?
<Eiam>
glosoli: right, which gives you a lockfile to help deploy your dependencies
<glosoli>
Eiam so could I prefer bundle for most of the things ?
<glosoli>
should I"
<Eiam>
glosoli: you should read up on what bundler does (https://bundler.io) so you understand what its designed to do and then you can make an informed decision about which command is appropriate to use in your specific situations.
bga57 has quit [Ping timeout: 248 seconds]
<Eiam>
"Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed."
georgie has joined #ruby
reber has joined #ruby
<Eiam>
`gem install rake` == give me whatever shit is out there
<Eiam>
`bundle install rake` == give me the shit defined in my bundle file
ramfjord has joined #ruby
<Eiam>
(bundle install <gem> doesn't really make sense)
<Eiam>
since the gemfile specifies the gems
<glosoli>
Eiam sorry for my ignorance, just realised that `bundle install gem-name` does nothing
<Eiam>
yeah i also realized i just mentally short handed that into 'bundle install' (gem file contains gem 'rake' ) which wouldn't help you understand the problem lol
<Eiam>
yeah =)
<Eiam>
glosoli: right =)
<glosoli>
Eiam basically my ignorance is based on the other languages I am used to, do I understand correctly that ruby has no concept of dev dependencies ?
<glosoli>
i.e. `rake` is as equal gem as any other library
<havenwood>
glosoli: It's a bit confusing, for historical reasons. The `bundle` commands are for installing a project's dependencies. The `gem` commands install gems ad hoc.
<Eiam>
not quite sure I follow that one, you can specify in your bundle file a development grouping of dependencies
<glosoli>
Eiam this kind of answers my question, thanks
<Eiam>
glosoli: rake is just another gem, yes. as is bundle for that mater.
<havenwood>
glosoli: There are three types of gems. Normal ones you install. Then "default gems" and "bundled gems" that ship with Ruby. This site covers the difference: https://stdgems.org/
<havenwood>
glosoli: Rake is a bbundled gem.
<havenwood>
(No relation to bundler >.>)
<havenwood>
We need to use more words for these things...
<glosoli>
so bundled gem comes together with Ruby ?
<havenwood>
glosoli: Yes, bundled and default gems ship with Ruby.
<havenwood>
glosoli: When you install Ruby, you already have gems.
<glosoli>
(again sorry if my questions are too stupid, just trying to get the wording right so I can carry on googling things)
guest6788 has left #ruby [#ruby]
<havenwood>
glosoli: The Ruby standard library is in the process of being extracted into gems that ship with Ruby.
<havenwood>
glosoli: Your questions aren't stupid at all. This is confusing for historical reasons.
<Eiam>
havenwood: seems weird, why pull them into gems? just to make the core smaller?
<Eiam>
out of band revs?
<glosoli>
havenwood so in that regard, it does not make much sense to have rake in Gemfile, since it comes together with Ruby ?
<havenwood>
Eiam: A couple reasons. One is to be able to update a gem for security reasons without shipping a new Ruby. (Ala the bigdecimal CVEs.)
<havenwood>
glosoli: You'd put it in the Gemfile to get a more recent version than the one that ships with Ruby.
<Eiam>
glosoli: rake can be uninstalled.
<havenwood>
And that ^
<Eiam>
if your product needs it, you should declare it
<havenwood>
Default gems can't be uninstalled, but Bundled gems can.
<glosoli>
damn in these several minutes I learned more than googling around without understanding the wording, thanks a lot
<Eiam>
i.e. bundler will be there if ruby is there. rake may not be there if ruby is there.
<havenwood>
Eiam: Also, for some it's a step towards removal from stdlib, like tk, curses, etc.
<Eiam>
havenwood: yeah, fair.
<glosoli>
if someone with lots years of experience on other languages would ask you for a quick intro into the language itself, is there some particular thing such as blog, articles, or books that one would suggest ?
reber has quit [Remote host closed the connection]
psmolen has joined #ruby
yalue has quit [Quit: Leaving]
ramfjord has quit [Ping timeout: 248 seconds]
ramfjord has joined #ruby
involans has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
glosoli has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
postmodern has joined #ruby
deepreds1 has joined #ruby
fphilipe has quit [Ping timeout: 248 seconds]
postmodern has quit [Quit: Leaving]
Fernando-Basso has joined #ruby
hexdroid has joined #ruby
hexdroid has quit [Client Quit]
DTZUZO has joined #ruby
Technodrome has joined #ruby
DTZUZO has quit [Ping timeout: 245 seconds]
Technodrome has quit [Remote host closed the connection]
milkohol has quit [Ping timeout: 244 seconds]
unreal has joined #ruby
fphilipe has joined #ruby
jenrzzz has joined #ruby
joast has quit [Quit: Leaving.]
ramfjord has quit [Ping timeout: 268 seconds]
deepreds1 has quit [Ping timeout: 268 seconds]
SidepocketNeo has quit [Ping timeout: 260 seconds]
joast has joined #ruby
<mlt->
How do I define a method that takes any arguments to be passed into parent with plain super? I want to wrap something but arguments might change in the future though I don't care about args at this moment
<mlt->
def mymethod(*arg1, **arg2) ?
ramfjord has joined #ruby
sameerynho has quit [Ping timeout: 246 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bitwinery has quit [Quit: Leaving]
fphilipe has quit [Ping timeout: 258 seconds]
<havenwood>
mlt-: `super` will pass both arguments and block, while `super(&nil)` will pass neither argument nor block.
<havenwood>
mlt-: `super()` will pass just the block, and `super(*args, &nil)` will pass just the arguments.