<ruby[bot]>
Talion: we in #ruby do not like irccloud.com, it has no syntax highlighting, distracting formatting and loads slowly for most. Please use https://gist.github.com
<linuus>
The `sync_with_remote` method makes a call to an external API. The method has been tested in isolation by passing in an API client mock.
<linuus>
Now I want to test that this perform method which instantiates a thing and then calls the sync method. I could pass an API client mock to the perform method which passes it along to the sync method, but that seems messy...
ShalokShalom has joined #ruby
Jonopoly has joined #ruby
al2o3-cr has joined #ruby
hightower2 has quit [Ping timeout: 252 seconds]
ellcs has joined #ruby
Nicmavr has joined #ruby
jenrzzz has joined #ruby
Kestrel-029 has quit [Ping timeout: 245 seconds]
jenrzzz has quit [Ping timeout: 248 seconds]
blackmesa1 has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
blackmesa has joined #ruby
blackmesa1 has quit [Ping timeout: 252 seconds]
Swyper has joined #ruby
Kestrel-029 has joined #ruby
Nicmavr has quit [Ping timeout: 245 seconds]
Swyper has quit [Ping timeout: 272 seconds]
alexeev has joined #ruby
blackmesa has quit [Ping timeout: 248 seconds]
marmotini_ has joined #ruby
kapilp has quit [Quit: Connection closed for inactivity]
gb_away has quit [Ping timeout: 244 seconds]
conta has quit [Ping timeout: 272 seconds]
sysvalve has joined #ruby
Swyper has joined #ruby
mikecmpbll has quit [Ping timeout: 248 seconds]
TomyWork has quit [Remote host closed the connection]
TomyWork has joined #ruby
tf2ftw has joined #ruby
slackmare has quit [Ping timeout: 258 seconds]
conta has joined #ruby
kapilp has joined #ruby
mikecmpbll has joined #ruby
laaron has quit [Remote host closed the connection]
AJA4350 has joined #ruby
Swyper has quit [Remote host closed the connection]
laaron has joined #ruby
mniip has quit [Read error: Connection reset by peer]
mniip has joined #ruby
Caerus has quit [Ping timeout: 245 seconds]
Caerus has joined #ruby
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
tdy has quit [Ping timeout: 245 seconds]
alexeev has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
UncleCid__ has joined #ruby
jenrzzz has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 268 seconds]
dar123 has joined #ruby
Swyper has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
Swyper has quit [Remote host closed the connection]
<zodd_>
never heard of it. It might be great, but is it sustainable: is it maintained, is there a community etc. Ie: what will be its state in 5 years time/is it worth investing in when developing a major project on it
pwnd_nsfw` has joined #ruby
<zodd_>
Not ment as a (negative) remark regarding pweewee, but a remark about software (libraries) in general
deepredsky has quit [Ping timeout: 258 seconds]
<ytti>
if i want sustainable and serious major project, i'm not going to choose python to begin with :)
<ytti>
(nor ruby)
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
AJA4351 is now known as AJA4350
<zodd_>
looks neat
octos has joined #ruby
<Jonopoly>
whats a good all-around OO project to do
<Jonopoly>
so i can do in most (if not all) languages
pwnd_nsfw has quit [Ping timeout: 258 seconds]
<Jonopoly>
to show a basic understanding of OO ?
<zodd_>
Jonopoly, not entirely sure what your question is, nor iof this is the place for it, but maybe it is worth your time to check out: http://rosettacode.org/wiki/Rosetta_Code
<zodd_>
*if
hmaronon has joined #ruby
twobitsprite has joined #ruby
<twobitsprite>
Is there something like the "requests" module from python for ruby?
<Jonopoly>
Rosetta?? haha
<Jonopoly>
Thanks zodd_
octos has quit [Ping timeout: 252 seconds]
<Jonopoly>
cucumber so annoying at times
<Jonopoly>
wish there was a "slow" down property T_T
<z64>
twobitsprite: you can take a look at the gems "rest-client" or "httparty"; there's others, but those are probably the most basic ones off the top of my head that are similar to requests
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rippa has joined #ruby
TomyWork has quit [Ping timeout: 246 seconds]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
laaron has quit [Remote host closed the connection]
orbyt_ has joined #ruby
jenrzzz has joined #ruby
laaron has joined #ruby
banisterfiend has joined #ruby
haxx0r has quit [Remote host closed the connection]
dviola has quit [Ping timeout: 258 seconds]
AJA4350 has quit [Ping timeout: 245 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hays has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.4]
Brian-W-Gray has quit [Quit: Give a man a phish, you might get his credentials. Teach a man to phish, he'll get someone elses.]
jenrzzz has quit [Ping timeout: 246 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
octos has joined #ruby
<havenwood>
twobitsprite: +1 HTTP.rb
<havenwood>
It's the most similar to Requests.
ellcs has quit [Ping timeout: 272 seconds]
octos has quit [Read error: Connection reset by peer]
andikr has quit [Remote host closed the connection]
esp32_prog has quit [Ping timeout: 252 seconds]
<zodd_>
how to try/catch or ruby equivalent a db connection to check how/why the connection errors? So far all my odbc attempts whether it being odbc, odbc-dbi or odbc-sequel
<zodd_>
+fail
banisterfiend has quit [Ping timeout: 246 seconds]
<zodd_>
quite sure the DSN is ok as it works ok and from other programming languages
<zodd_>
*works ok from shell
blackmesa has quit [Ping timeout: 252 seconds]
iffraff has joined #ruby
sysvalve has quit [Quit: Leaving]
<iffraff>
Hello, I', a complete ruby novice. I have a new job and they are using ruby and they are using foreman, to start stuff up from a procfile. I've noticed that the processes are starting up asynchronously. I was wondering if there is anyway to have them run synchronously.
<iffraff>
havenwood: ah, that might work. I'll give that a try. thank you
c0dec has joined #ruby
blackmesa has joined #ruby
conta has joined #ruby
r29v has quit [Ping timeout: 248 seconds]
esp32_prog has quit [Ping timeout: 248 seconds]
duderonomy has joined #ruby
Jonopoly_ has quit [Quit: WeeChat 2.4]
al1 has joined #ruby
AJA4350 has joined #ruby
al1 has quit [Client Quit]
cisco has quit [Ping timeout: 272 seconds]
zodd_ has quit [Ping timeout: 248 seconds]
zacts has joined #ruby
twobitsprite has quit [Ping timeout: 248 seconds]
jenrzzz has joined #ruby
banisterfiend has joined #ruby
zacts has quit [Quit: WeeChat 2.4]
jenrzzz has quit [Ping timeout: 246 seconds]
gix has joined #ruby
banisterfiend has quit [Client Quit]
banisterfiend has joined #ruby
<banisterfiend>
sdf
jenrzzz has joined #ruby
<banisterfiend>
woohoo!
<banisterfiend>
finally got my irc client to connect outisde the vpn :)
govg has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
banisterfiend has quit [Ping timeout: 248 seconds]
salerace has quit [Ping timeout: 252 seconds]
ravenous_ has joined #ruby
twobitsprite has joined #ruby
emilford has joined #ruby
octos has joined #ruby
salerace has joined #ruby
gix has quit [Ping timeout: 246 seconds]
gix has joined #ruby
molly has joined #ruby
molly is now known as Guest64648
ramfjord has joined #ruby
octos has quit [Ping timeout: 248 seconds]
doodlebug has joined #ruby
doodlebug has quit [Max SendQ exceeded]
nowhere_man has quit [Ping timeout: 246 seconds]
schne1der has joined #ruby
doodlebug has joined #ruby
iffraff has quit [Ping timeout: 248 seconds]
iffraff has joined #ruby
iffraff has quit [Remote host closed the connection]
octos has joined #ruby
AJA4351 has joined #ruby
codefriar has joined #ruby
cisco has joined #ruby
cisco is now known as Guest87502
Guest64648 has quit [Ping timeout: 248 seconds]
<codefriar>
If I've loaded a yml file with Psych.load_file is there anyway I can dynamically get a part of that object? ie: foo["#{bar}"] but bar = [key][1]
AJA4350 has quit [Ping timeout: 248 seconds]
AJA4351 is now known as AJA4350
<havenwood>
codefriar: So bar is a String with square braces in it?
<codefriar>
havenwood yep. Trying to create a reusable method to pull an arbitrary array out of an object loaded from yml. So I can add to the array, and write the file back.
<havenwood>
foo.dig *bar.scan(/[^\[\]]+/)
<jhass>
sound's like you're reinventing Hash#dig
<havenwood>
codefriar: By 1, do you mean an Array index?
tdy has quit [Ping timeout: 258 seconds]
<jhass>
where does the string come from?
octos has quit [Read error: Connection reset by peer]
<havenwood>
codefriar: +1 where does the string come from?
octos has joined #ruby
<codefriar>
havenwood let me backup. I'm needing to open a yml, and add an entry to an array. In this first instance, the yml file is a static site generator list of sub pages.
<codefriar>
The string comes from my futzing arround in pry
<havenwood>
codefriar: If you're ever going to be writing from more than one process, Ruby stdlib has YAML::Store for transactional file storage in YAML.
<codefriar>
Oh damn, that's slick wth is happening?
jeremycw has joined #ruby
<jhass>
* is called the splat parameter, it passes each array element as an individual argument to the method
<codefriar>
jhass thats f'ing awesome
<jhass>
works in general for any method call of course
<jhass>
view it as the inverse of a varargs argument in a method definition, that is a method parameter that collects all (remaining) positional arguments into an array: def foo(*args)
octos has joined #ruby
Guest511 has quit [Ping timeout: 250 seconds]
octos has quit [Remote host closed the connection]
octos has joined #ruby
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
lxsameer has quit [Ping timeout: 248 seconds]
octos has quit [Read error: Connection reset by peer]
octos has joined #ruby
laaron has quit [Remote host closed the connection]
fphilipe_ has joined #ruby
houhoulis has joined #ruby
conta has quit [Ping timeout: 248 seconds]
laaron has joined #ruby
altious has quit [Read error: Connection reset by peer]
altious has joined #ruby
yoshie902a has joined #ruby
<yoshie902a>
Does anyone know what ‘if_dne” means?
<jhass>
not without context context context
<yoshie902a>
def self.[](id, &if_dne)
<yoshie902a>
all.fetch id&.intern, &if_dne
<yoshie902a>
end
<yoshie902a>
Oops, sorry, should have made a gist
<jhass>
call example?
<jhass>
looks like terrible code tbh :D
<phaul>
it's just a name of an argument. like id. except it's a block argument
<yoshie902a>
so essentially, if_dne is a block that is getting passed into the method and then it runs the all.fetch id&.intern, &if_dne. &if_dne being the block that was passed in.
<jhass>
no if there, but yeah
<jhass>
if there's no block if_dne will be nil and &nil will just pass no block
<jhass>
simple terms: Product#[] forwards any given block to Hash#fetch
<yoshie902a>
ok, thank you
Bounga has joined #ruby
<yoshie902a>
Can you tell me what self[__method__]
<yoshie902a>
is doing?
<yoshie902a>
i have never seen this syntax either
Nicmavr has quit [Ping timeout: 245 seconds]
<havenwood>
yoshie902a: In Ruby 2.6 you can combine lines 8 & 9 using: .to_h { |id, attrs| ...
<havenwood>
>> def foo; __method__ end; foo
<havenwood>
#=> :foo
<ruby[bot]>
havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
yoshie902a: Alternatively, you could make it a *real* ActiveModel backed by the YAML. :) I gave a talk on how to back your Models with an API (or YAML file works too) at RailsConf.
<jhass>
I think the id&. is a really big smell here btw
<jhass>
why would you ever pass nil there and silently handle it
<yoshie902a>
Can you point me to how to have an active model backed by YAML?
<havenwood>
yeah, actually thinking about this a generic one isn't going to work for your particular case - but you can make it work custom anyhow.
<yoshie902a>
It would be helpful to see for learning purposes
<yoshie902a>
and I could see how I could adapt it
blackmesa has joined #ruby
voodoofish430 has joined #ruby
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
kapilp has quit [Quit: Connection closed for inactivity]
jrafanie_ has joined #ruby
jefffrails35 has quit [Remote host closed the connection]
jrafanie has quit [Ping timeout: 246 seconds]
schne1der has quit [Ping timeout: 248 seconds]
SID790 has left #ruby ["Konversation terminated!"]
hays has quit [Ping timeout: 258 seconds]
hays has joined #ruby
Cache_Money has joined #ruby
hays has quit [Ping timeout: 248 seconds]
hays has joined #ruby
<Cache_Money>
I have an array of hashes. Inside each hash is a `values` key with an array of floats. I’d like to order the hash objects inside the outter array by the last item in the `values` key. Can anyone help me with a way to go about this?
<jhass>
.sort_by {|hash| hash["values"].last }
<jhass>
.sort_by returns a new sorted array, sort_by! sorts the existing array in place
jcalla has quit [Quit: Leaving]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Cache_Money>
jhass: Awesome, that worked perfectly! Thanks!!
fphilipe_ has joined #ruby
fredolinhares has joined #ruby
Nicmavr has quit [Ping timeout: 245 seconds]
Nicmavr has joined #ruby
hays has quit [Ping timeout: 248 seconds]
hays has joined #ruby
houhouli_ has joined #ruby
dragonkh has joined #ruby
<dragonkh>
evening
dragonkh has left #ruby [#ruby]
houhoulis has quit [Ping timeout: 272 seconds]
yoshie902a has quit [Quit: yoshie902a]
hays has quit [Ping timeout: 245 seconds]
hays has joined #ruby
reber has quit [Remote host closed the connection]
evdubs has quit [Remote host closed the connection]