<apotheon>
Yeah, Ethon looks good for one example.
dionysus69 has quit [Ping timeout: 272 seconds]
<apotheon>
Ah, yes, bcrypt uses a quite different approach than ethon. These two already give me some good examples.
Guest5216 has quit [Ping timeout: 272 seconds]
davidw has quit [Ping timeout: 240 seconds]
bsdbandit-01 has quit [Ping timeout: 265 seconds]
bsdband86 has joined #ruby
fphilipe_ has quit [Ping timeout: 260 seconds]
lxsameer has quit [Quit: WeeChat 2.6]
Mrgoose845701915 has joined #ruby
davidw has joined #ruby
citizentwo has quit [Remote host closed the connection]
drincruz has quit [Ping timeout: 272 seconds]
cnsvc has joined #ruby
strmpnk has quit []
strmpnk has joined #ruby
strmpnk has quit [Client Quit]
strmpnk has joined #ruby
Guest48 has joined #ruby
Guest48 is now known as smurfke
<smurfke>
Hello, I am learning Ruby. I want to execute something e.g. puts "Dog found!" when the following statement returns true: ["dog", "small cat", "big dog].any? { |text| text.include? "dog" }. How do I combine these two in the most elegant way?
<CommunistWolf>
puts "dog found" if [...].any? { ... }
<smurfke>
thank you!
<CommunistWolf>
the if has to be on the same line as the puts for it to work
<CommunistWolf>
otherwise it assumes it's the start of a block that needs terminating with end
hutch has joined #ruby
<smurfke>
indeed, I figured thank you very much
<smurfke>
CommunistWolf , can I however put the individual array items on different lines?
<CommunistWolf>
sure
<smurfke>
great!
<CommunistWolf>
ruby is *fairly* chill about whitespace, there are only a few areas where it acts weird
citizentwo has joined #ruby
hutch has quit [Quit: WeeChat 2.7]
pinpox has joined #ruby
pinpox- has quit [Ping timeout: 268 seconds]
hutch has joined #ruby
skryking_ has joined #ruby
davidw has quit [Ping timeout: 272 seconds]
skryking has quit [Ping timeout: 272 seconds]
summertalk has joined #ruby
pwnd_nsfw` has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
wildtrees has quit [Quit: Leaving]
Rob__ has joined #ruby
pwnd_nsfw has quit [Ping timeout: 265 seconds]
splud_wurk has quit [Quit: splud_wurk]
pwnd_nsfw has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 260 seconds]
citizentwo has quit [Remote host closed the connection]
cthulchu_ has quit [Read error: Connection reset by peer]
cthulchu_ has joined #ruby
Rob__ has quit [Ping timeout: 260 seconds]
pwnd_nsfw` has joined #ruby
pwnd_nsfw has quit [Ping timeout: 260 seconds]
citizentwo has joined #ruby
hutch has quit [Quit: WeeChat 2.7]
cisco has joined #ruby
cisco has quit [Remote host closed the connection]
GodFather has quit [Ping timeout: 260 seconds]
duderonomy has joined #ruby
citizentwo has quit [Remote host closed the connection]
citizentwo has joined #ruby
meinside has joined #ruby
turbo_choo has joined #ruby
alfiemax has joined #ruby
dviola has quit [Quit: WeeChat 2.7]
cthu| has joined #ruby
alfiemax has quit [Ping timeout: 272 seconds]
cthulchu_ has quit [Ping timeout: 260 seconds]
cthu| has quit [Read error: Connection reset by peer]
cthu| has joined #ruby
BTRE has quit [Quit: Leaving]
BTRE has joined #ruby
<smurfke>
Hello. I am confused by the following 'and' statement: bus && "BUS #{bus}". Confusion: variable bus is in fact a string here so what does this && do exactly?
<akemhp>
smurfke, If you try something like a=bus && "BUS #{bus}";puts a; you just got the second expression...I think it's not doing anything particular if it's not inside another expression maybe. But i never use && except in bash shell sometimes.
z4phod has joined #ruby
<smurfke>
thanks
<smurfke>
I thought it checked for bus not being nil
alfiemax has quit [Ping timeout: 260 seconds]
TCZ has quit [Quit: Bye Bye]
johnny56 has quit [Ping timeout: 240 seconds]
johnny56 has joined #ruby
PikaChokeMe__ has quit [Read error: Connection reset by peer]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
turbo_choo has joined #ruby
skryking has joined #ruby
skryking_ has quit [Ping timeout: 265 seconds]
turbo_choo has quit [Ping timeout: 265 seconds]
turbo_choo has joined #ruby
cthu| has quit [Ping timeout: 272 seconds]
smurfke has quit [Remote host closed the connection]
scipio_africanu4 has joined #ruby
braincrash has quit [Quit: bye bye]
ur5us has quit [Ping timeout: 240 seconds]
braincrash has joined #ruby
Lyubo1 has quit [Ping timeout: 272 seconds]
gix has quit [Ping timeout: 240 seconds]
polishdub has joined #ruby
alfiemax has joined #ruby
Lyubo1 has joined #ruby
x0n has quit [Ping timeout: 260 seconds]
cadeskywalker has quit [Ping timeout: 260 seconds]
cadeskywalker has joined #ruby
houhoulis has quit [Remote host closed the connection]
houhoulis has joined #ruby
davidw has joined #ruby
davidw has joined #ruby
davidw has quit [Changing host]
donofrio has quit [Remote host closed the connection]
TzilTzal has joined #ruby
<TzilTzal>
Hi
<havenwood>
TzilTzal: hi
<TzilTzal>
Question: is ActiveRecord tied to a database? does it have to be?
<baweaver>
Depends
<baweaver>
The easy answer is yes.
<baweaver>
The much more involved answer is it could be used to query much of anything as an API
<baweaver>
havenwood even did a talk on this at RailsConf last year
<baweaver>
That could technically involve file systems, APIs, systems, you name it. As long as it can expose an interface that's like AR you could use most of it
<baweaver>
Maybe not the dirty checks and some of the validations that don't make sense in those contexts.
<TzilTzal>
How is it all unit tested then? is it even possible to unit test?
<havenwood>
baweaver: I think dirty does make sense for those, really. If it's CRUD, most of ActiveModel is on point.
<baweaver>
Ok, maybe not the best example, fair
<baweaver>
It's not
<havenwood>
baweaver: Haha, I did do a talk on this. Just found the link.
<havenwood>
TzilTzal: TzilTzal: ActiveRecord is tied to a database of some sort, and that's what puts the Record in
<baweaver>
Unit testing infers no external dependencies
<havenwood>
That wasn't the link.
<baweaver>
it's used for functions
<baweaver>
It'd be integration testing of integrated systems by that point
<TzilTzal>
baweaver: that's precisely what I'm getting at and would like to do. But the code base seems to be inheriting from ActiveRecord directly in tons of places.
<baweaver>
What you do with that retrieved data, excluding updating it and saving it back, can be unit testeed
<baweaver>
Mostly use FactoryBot and build instead of create
<baweaver>
build makes a model object but doesn't save it
<havenwood>
TzilTzal: ActiveResource is a good example of Rails itself having an alternative ActiveModel to ActiveRecord, along with unit tests. In that ^ talk, I show how to make your own API-backed ActiveRecord-like and how Rails provide starter tests to get you going.
<baweaver>
So you can do things "on" an AR object without that
<havenwood>
TzilTzal: You tests units just like if it's DB backed. You can't tell the difference from the interface.
<TzilTzal>
havenwood: you're referring to ActiveResource or ActiveModel?
<havenwood>
TzilTzal: In the talk, I make an ActiveRecord-like interface that's backed by Square's API.
<havenwood>
TzilTzal: ActiveResource is one variant of a model that's actually a Rails API under the hood.
<havenwood>
TzilTzal: I talk about it in that ^ talk
<TzilTzal>
I see. I'll check it out - thanks a lot!
<havenwood>
"Active Resource attempts to provide a coherent wrapper object-relational mapping for REST web services. It follows the same philosophy as Active Record, in that one of its prime aims is to reduce the amount of code needed to map to these resources."
<baweaver>
We both work over there so we're a bit biased.
<havenwood>
TzilTzal: It turns out, if you can CRUD, it pretty much works. :)
<TzilTzal>
havenwood: why not use dependency injection for 'API', for instance? So it doesn't have to be a Squre::Client?
<havenwood>
TzilTzal: Various reasons to have a bunch of clients. A client can have a thread pool of persistent connections (not in this example).
jenrzzz has quit [Ping timeout: 260 seconds]
<TzilTzal>
havenwood: so? :)
<TzilTzal>
You can inject Square::Client, but anything that has the same interface as well.
<havenwood>
TzilTzal: Clients are immutable(ish), so no swapping tokens or whatever. I may misunderstand your question.
<havenwood>
TzilTzal: Oh, I just meant this to be an example of using a very specific API interface. It could be a filesystem or anything else that can CRUD under the hood.
<TzilTzal>
I see.
<havenwood>
TzilTzal: ActiveResource assumes the foreign API interface will be a Rails API - so it can *just work*.
polishdub has quit [Remote host closed the connection]
<havenwood>
TzilTzal: This is a bespoke implementation, from scratch against ActiveModel with the new Rails 5.2 ActiveModel::Attributes feature.
<havenwood>
TzilTzal: I chose a specific API from work, but it doesn't have to be an API at all.
<havenwood>
TzilTzal: You could back it with a directory structure, a JSON file, Telnet, a camera with OCR you put flashcards in front of, whatever.
<TzilTzal>
Cool. Looking for something like that.
jenrzzz has joined #ruby
<havenwood>
TzilTzal: The nice thing about ActiveModel is Rails is providing an extensible interface to build your own. I try to show how in that ^ talk.
<havenwood>
TzilTzal: Lemme know if you have questions about backing a different type of data store. :)
davidw has quit [Ping timeout: 265 seconds]
jenrzzz has quit [Ping timeout: 265 seconds]
<TzilTzal>
Will do. Thanks!
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
fphilipe_ has joined #ruby
TzilTzal has quit [Remote host closed the connection]
TzilTzal has joined #ruby
jenrzzz has joined #ruby
sauvin has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
tpanarch1st has quit [Ping timeout: 255 seconds]
bsdband86 has quit [Ping timeout: 260 seconds]
funnel has quit [Ping timeout: 260 seconds]
funnel has joined #ruby
jenrzzz has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
jenrzzz has quit [Ping timeout: 260 seconds]
Intelo has quit [Ping timeout: 260 seconds]
schne1der has joined #ruby
gr33n7007h has joined #ruby
houhoulis has quit [Remote host closed the connection]
al2o3-cr has quit [Ping timeout: 256 seconds]
TzilTzal has quit [Remote host closed the connection]
fphilipe_ has quit [Ping timeout: 272 seconds]
fphilipe_ has joined #ruby
schne1der has quit [Ping timeout: 260 seconds]
TzilTzal has joined #ruby
ttoocs has joined #ruby
TzilTzal has quit [Remote host closed the connection]
TzilTzal has joined #ruby
alfiemax has quit [Remote host closed the connection]
DaisyNewTownGirl has joined #ruby
timhugh has joined #ruby
zapata_ has joined #ruby
zapata has quit [Read error: Connection reset by peer]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
DaisyNewTownGirl has quit [Quit: Leaving]
sergioro has joined #ruby
grr12314 has joined #ruby
alfiemax has joined #ruby
darkstardev13 has quit [Ping timeout: 256 seconds]
phaul has joined #ruby
noizex has quit [Ping timeout: 268 seconds]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_phaul has quit [Ping timeout: 268 seconds]
thecoffemaker has quit [Ping timeout: 265 seconds]
ur5us has joined #ruby
thecoffemaker has joined #ruby
summertalk has quit [Quit: WeeChat 2.6]
freshmaker666 has quit [Ping timeout: 260 seconds]
fercell has joined #ruby
darkstardev13 has joined #ruby
TomyWork has joined #ruby
dionysus69 has joined #ruby
alfiemax has quit [Remote host closed the connection]
fphilipe_ has quit [Ping timeout: 272 seconds]
schne1der has joined #ruby
turbo_choo has quit [Ping timeout: 268 seconds]
fercell has quit [Quit: WeeChat 2.7]
fercell has joined #ruby
freshmaker666 has joined #ruby
freshmaker666 has quit [Changing host]
freshmaker666 has joined #ruby
fercell has quit [Client Quit]
fercell has joined #ruby
conta has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
sergioro has quit [Quit: leaving]
fphilipe_ has joined #ruby
alfiemax has joined #ruby
fanta1 has joined #ruby
clemens3 has joined #ruby
chalkmonster has joined #ruby
mikecmpbll has joined #ruby
fig-le-deunch has joined #ruby
cisco has joined #ruby
vondruch has quit [Ping timeout: 260 seconds]
vondruch has joined #ruby
lxsameer has joined #ruby
taserface has quit [Quit: Leaving]
Eiam has quit [Ping timeout: 245 seconds]
xorl has quit [Ping timeout: 268 seconds]
chalkmonster has quit [Quit: WeeChat 2.7]
batisi[m] has joined #ruby
batisi[m] is now known as Batisi[m]
ur5us has quit [Ping timeout: 260 seconds]
davor_ has joined #ruby
davor has quit [Ping timeout: 240 seconds]
davor_ is now known as davor
alexherbo2 has joined #ruby
fig-le-deunch has quit [Quit: Konversation terminated!]
ratah has joined #ruby
fig-le-deunch has joined #ruby
xorl has joined #ruby
jmcgnh has quit [Ping timeout: 246 seconds]
ldepandis has joined #ruby
Fernando-Basso has joined #ruby
conta has quit [Quit: conta]
jmcgnh has joined #ruby
TCZ has joined #ruby
gr33n7007h is now known as al2o3-cr
dionysus69 has quit [Quit: dionysus69]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
JediMaster has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
<JediMaster>
Hi, I'm using a Chef recipe that installs the gem "acme-client" 2.0.3, this requires farady ~>0.9, >=0.9.1
<JediMaster>
I've been using this same version of the recipe for months without problem and recently it's now broken the Chef-client run completely with the Gem error: Unable to activate acme-client-2.0.5, because faraday-1.0.0 conflicts with faraday (~> 0.9, >= 0.9.1)
<JediMaster>
The thing is, I can't see any reference to Faraday 1.0.0 anywhere, why is it trying to install both versions?
NODE has quit [Client Quit]
alexherbo2 has quit [Ping timeout: 272 seconds]
chalkmonster has joined #ruby
NODE has joined #ruby
zapata_ has quit [Ping timeout: 246 seconds]
alexherbo27 has joined #ruby
alexherbo27 is now known as alexherbo2
NODE has quit [Quit: changing servers]
NODE has joined #ruby
_phaul has joined #ruby
donofrio has joined #ruby
joast has quit [Ping timeout: 265 seconds]
xco has joined #ruby
phaul has quit [Ping timeout: 240 seconds]
zululee_ has quit [Quit: Ping timeout (120 seconds)]
zululee_ has joined #ruby
zapata_ has joined #ruby
turbo_choo has joined #ruby
Rob__ has joined #ruby
zapata_ is now known as zapata
NODE has quit [Quit: changing servers]
pwnd_nsfw` has quit [Ping timeout: 272 seconds]
NODE has joined #ruby
fig-le-deunch has quit [Quit: Konversation terminated!]
NODE has quit [Quit: changing servers]
clemens3 has quit [Quit: WeeChat 2.1]
NODE has joined #ruby
clemens3 has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
royal_screwup21 has joined #ruby
<JediMaster>
So, what it looks like is acme-client gem requires ~>0.9 which won't accept 1.0.0, and inspec-core requires >=0.9.0. I think the inspec-core one is then forcing faraday 1.0.0 to install which conflicts with anything old, which then breaks everything
royal_screwup21 has quit [Remote host closed the connection]
conta has joined #ruby
royal_screwup21 has joined #ruby
jmcgnh has quit [Ping timeout: 272 seconds]
al2o3-cr has quit [Quit: WeeChat 2.7]
jmcgnh has joined #ruby
al2o3-cr has joined #ruby
<jhass>
JediMaster: do you have any control over the script that requires acme-client? How it's launched or maybe even its contents?
royal_screwup21 has quit [Remote host closed the connection]
x0n has joined #ruby
snuz has joined #ruby
royal_screwup21 has joined #ruby
phaul has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
_phaul has quit [Ping timeout: 272 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
mojca has joined #ruby
burningserenity has joined #ruby
<mojca>
How can I call Open3.capture3 (for example on Windows) when the binary lives in path with spaces (like C:\Program Files\something)
Swyper has joined #ruby
<Swyper>
hi
<Swyper>
havenwood: are you around ?
<Swyper>
def cube_equals_to(n, t)
<Swyper>
A = [-n*n*n..n*n*n]
<Swyper>
end
<Swyper>
trying to create an array of integers from the [-n^3, n^3]
<Swyper>
**from the range
<Swyper>
A = [*(-n*n*n)..(n*n*n)] might work
<Swyper>
though I should throw n*n*n into a variable
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
lineus has quit [Ping timeout: 240 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
JediMaster has quit [Ping timeout: 272 seconds]
lineus has joined #ruby
lucasb has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
alfiemax has quit [Remote host closed the connection]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
cow[moo] has joined #ruby
<TomyWork>
https://thoughtbot.com/blog/ruby-2-keyword-arguments if I use the foo: argument syntax in the function definition, can i get the options hash somehow in order to pass it through to another function wholesale?
<TomyWork>
as in "def bar(foo:)"
NODE has quit [Quit: changing servers]
schne1der has quit [Ping timeout: 240 seconds]
NODE has joined #ruby
JediMaster has joined #ruby
JediMaster is now known as Guest34409
jmcgnh has quit [Ping timeout: 265 seconds]
TCZ has quit [Quit: Bye Bye]
howdoi has joined #ruby
chamunks has joined #ruby
jmcgnh has joined #ruby
jmcgnh has quit [Ping timeout: 260 seconds]
<grr12314>
lowercase a
john2496 has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
drincruz has joined #ruby
<TomyWork>
grr12314, was that in response to me?
iNs has quit [Remote host closed the connection]
<grr12314>
no, to Swyper. i didn't look at timestamps and didn't realize how late i was
<TomyWork>
oh, no it was in response to Swyper
iNs has joined #ruby
Guest34409 has quit [Ping timeout: 260 seconds]
vondruch has quit [Ping timeout: 260 seconds]
schne1der has joined #ruby
<al2o3-cr>
TomyWork: what do you mean get options hash?
<al2o3-cr>
maybe you are wanting **kwargs
NODE has quit [Quit: changing servers]
NODE has joined #ruby
alfiemax has joined #ruby
alfiemax_ has joined #ruby
conta has quit [Quit: conta]
NODE has quit [Client Quit]
alfiemax has quit [Ping timeout: 246 seconds]
NODE has joined #ruby
GodFather has joined #ruby
Swyper has quit [Remote host closed the connection]
skryking has quit [Remote host closed the connection]
skryking has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
SeepingN has joined #ruby
Intelo has joined #ruby
vondruch has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
Guest34409 has joined #ruby
joast has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
ttoocs has quit [Ping timeout: 268 seconds]
Guest34409 is now known as JediMaster
<JediMaster>
jhass, Partially, I could temporarily change it. It's simply a: "require 'acme-client'" from a Chef recipe
<JediMaster>
With a chef_gem resource that installs acme-client with a specific version (2.0.3, not quite the latest, but the latest version doesn't change it's dependencies and still causes the same problem)
NODE has quit [Quit: changing servers]
<JediMaster>
I suspect if the ~>0.9 dependency was removed it would work. Or equally if inspec-core had ~>0.9 on the farady dependency that would sort it too
NODE has joined #ruby
jmcgnh has joined #ruby
tpanarch1st has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
<TomyWork>
al2o3-cr, yes, i kinda want my cake and eat it, too :)
<TomyWork>
i want to use the syntactic sugar in the function definition so i dont have to deconstruct the kwargs hash
<TomyWork>
but i also want to be able to pass the kwargs hash on to another function
cisco has quit [Read error: Connection reset by peer]
turbo_choo has quit [Ping timeout: 268 seconds]
tsujp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
davidw has joined #ruby
davidw has joined #ruby
<TomyWork>
al2o3-cr, holy hell, i was more thinking about a language feature, not black magic :D
cisco has joined #ruby
grr12314 has left #ruby [#ruby]
cisco is now known as Guest72869
wildtrees has joined #ruby
wildtrees has quit [Remote host closed the connection]
wildtrees has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
Fernando-Basso has joined #ruby
NODE has quit [Quit: changing servers]
coffeex3 has joined #ruby
<al2o3-cr>
TomyWork: hm, yeah, there is none :P
NODE has joined #ruby
skryking has quit [Quit: WeeChat 1.9.1]
<JediMaster>
Is there any way to stop gem from trying to install a specific gem?
<JediMaster>
Either that, or is it possible to change the dependencies of a gem we're installing?
<al2o3-cr>
TomyWork: just pass **kwargs and kwargs.slice(blah, blah)
<havenwood>
JediMaster: You can always fork a gem and make changes. There's no automagical way to omit dependencies without modifying a gem.
cthu| has joined #ruby
<JediMaster>
Thought so, thanks havenwood
NODE has quit [Quit: changing servers]
clemens3 has quit [Quit: WeeChat 2.1]
<JediMaster>
havenwood, how would I go about including a different repository for gem?
NODE has joined #ruby
NODE has quit [Client Quit]
<havenwood>
JediMaster: You have a variety of options. You can just modify the gem in place, to try it out, with `gem open foo` then restore it with `gem pristine foo`. Then you can clone the repo, make the change, and point at the local gem location. Or, you can fork the gem, put it on GitHub, and point it there. Or, finally, you can fork the gem, publish it by another name, use that.
NODE has joined #ruby
Guest72869 has quit [Ping timeout: 268 seconds]
dviola has joined #ruby
citizentwo has quit [Remote host closed the connection]
citizentwo has joined #ruby
burningserenity has quit [Quit: Leaving.]
burningserenity has joined #ruby
NODE has quit [Quit: changing servers]
mikecmpbll has quit [Quit: inabit. zz.]
NODE has joined #ruby
NODE has quit [Client Quit]
NODE has joined #ruby
schne1der has quit [Ping timeout: 240 seconds]
cisco has joined #ruby
gix has joined #ruby
cisco is now known as Guest49462
coffeex3 has quit [Ping timeout: 240 seconds]
TomyWork has quit [Ping timeout: 256 seconds]
teardown has joined #ruby
ag4ve_ has joined #ruby
Fernando-Basso has quit [Quit: Leaving]
<ag4ve_>
i'm trying to convert json to a ruby hash w/ a one liner of: require 'json'; require 'pp'; pp dJSON.parse(ARGF.read) # which is giving a common.rb:155:in `parse` error but jq (unix command) is ok with the json file - any ideas where to look for the issue?
Swyper has joined #ruby
grilix has joined #ruby
<havenwood>
ag4ve_: In the most recent Rubies, PP is now pre-required, so you can skip requiring it. :)
<havenwood>
ag4ve_: What is ARGF.read?
<havenwood>
ag4ve_: p ARGF.read
JediMaster has quit [Ping timeout: 265 seconds]
Guest49462 has quit [Quit: leaving]
<havenwood>
ag4ve_: Are you giving it a filename or piping to it?
dviola has quit [Quit: WeeChat 2.7]
<ag4ve_>
yeah, so trying to extract chef environment things into a ruby hash, so cat file.json | jq -rsS '.[] | .override_attributes[]' | ruby -e '...'
dStromboli has quit [Quit: WeeChat 2.7]
<ag4ve_>
i'd expect jq to error first if there was really a json syntax issue...?
alfiemax_ has quit [Remote host closed the connection]
<al2o3-cr>
no, sorry, yeah, that's line by line :(
Guest48 is now known as smurfke
<al2o3-cr>
ag4ve_: what does `cat file.json | jq -rsS '.[] | .default_attributes[]'` produce?
Ai9zO5AP has joined #ruby
<ytti>
brrrrr jq
<ag4ve_>
67 lines - nothing to stderr - looks proper
<ag4ve_>
oh $? is 0
<al2o3-cr>
ruby's json doesn't like something
<al2o3-cr>
ag4ve_: are you able to share the json file in question?
Eiam has joined #ruby
<al2o3-cr>
ag4ve_: what's the output of `p ARGF.read`
snickers has joined #ruby
<ag4ve_>
no, it's a chef environment file for $work
<al2o3-cr>
ah, i missed that.
<al2o3-cr>
oh, i see
wildtrees has quit [Remote host closed the connection]
<al2o3-cr>
ag4ve_: try jq -rS it's putting everything into an array
wildtrees has joined #ruby
<al2o3-cr>
ag4ve_: just ignore me today.
<al2o3-cr>
i'm being seriously stupid today.
<ag4ve_>
yeah, well, i'm trying to figure out what i can share / read through this and see if i can find the error - the override stuff being only 67 lines is probably where i'm going...