<beefjoe70>
and I'm getting {"resultType":"Integer","result":2}
<beefjoe70>
for example
<beefjoe70>
which is what I want, but how can I retrieve result only ?
<beefjoe70>
using .result gives an undefined method error
sylario has joined #ruby
chouhoulis has joined #ruby
<z64>
beefjoe70: if you just have an opaque string, you need to parse that into a ruby object you can traverse first. you likely want to `require 'json'` and then pass that string to `JSON.parse` so you can access the data as a hash
<beefjoe70>
but how can I have variables if it's a string ?
<beefjoe70>
but then the whole thing is a string and doesn't give me the result I want
t0xik has quit [Quit: Connection closed for inactivity]
apeiros has joined #ruby
bmurt has joined #ruby
lxsameer has quit [Ping timeout: 268 seconds]
thapakazi has quit [Quit: thapakazi]
troulouliou_div2 has quit [Remote host closed the connection]
Rapture has joined #ruby
k0mpa has joined #ruby
govg has joined #ruby
eblip has quit [Quit: WeeChat 1.9.1]
vondruch_ has joined #ruby
amar has joined #ruby
ellcs has quit [Ping timeout: 268 seconds]
Guest13111 is now known as ged
ged is now known as Guest96163
vondruch has quit [Ping timeout: 276 seconds]
vondruch_ is now known as vondruch
karapetyan has quit [Remote host closed the connection]
cyberg has quit [Ping timeout: 240 seconds]
biberu has quit []
ta_ has quit [Remote host closed the connection]
cyberg has joined #ruby
beefjoe70 has quit [Ping timeout: 256 seconds]
saTchymoto has quit []
dinfuehr has quit [Ping timeout: 248 seconds]
ramfjord has joined #ruby
beefjoe70 has joined #ruby
lxsameer has joined #ruby
cschneid has quit [Ping timeout: 256 seconds]
dinfuehr has joined #ruby
thapakazi has joined #ruby
alfiemax has quit [Remote host closed the connection]
karapetyan has joined #ruby
alfiemax has joined #ruby
ramfjord has quit [Ping timeout: 256 seconds]
banisterfiend has joined #ruby
<beefjoe70>
how to parse json that has to be a string but have variables in it?
Libre has joined #ruby
minimalism has joined #ruby
cyberg has quit [Ping timeout: 260 seconds]
arkinor has joined #ruby
arashb has joined #ruby
cyberg has joined #ruby
<havenwood>
beefjoe70: Why do we use JSON? Sometimes we want to store code as a String. Say we have an Array of Integers and we want to store them as a string then reconstitute them into code. You can turn Ruby into a String like: [1, 2, 3].inspect #=> "[1, 2, 3]"
<havenwood>
beefjoe70: Then you can turn that String back into Ruby code like: eval "[1, 2, 3]" #=> [1, 2, 3]
<havenwood>
beefjoe70: That works fine, but when you eval a String, you're running arbitrary code.
<beefjoe70>
which is insecure
<beefjoe70>
gonna work on that later sure
<havenwood>
beefjoe70: Right, you don't want to: eval "FileUtils.rm 'oops'"
mostlybadfly has joined #ruby
<beefjoe70>
hehe
<havenwood>
beefjoe70: So we use serializers instead of evaling code. They can only serialize specific data structures, so they're safe. (Some safer than others, because they can serialize less.)
chouhoulis has quit [Remote host closed the connection]
dbugger_ has joined #ruby
<havenwood>
beefjoe70: You deserialize Ruby to a String. Then you serialize it back into Ruby.
<havenwood>
beefjoe70: Marshal and YAML can serialize lots of things, so they're unsafe - similar to eval.
<havenwood>
beefjoe70: JSON is a subset of YAML that's safe by default.
<havenwood>
Use JSON.parse instead of JSON.load, or JSON is unsafe too.
<beefjoe70>
hmm interesting
Guest96163 has quit [Quit: WeeChat 2.0.1]
<beefjoe70>
one question
<beefjoe70>
what's the difference between that and openstruct ?
ged_ has joined #ruby
<havenwood>
An OpenStruct is a datastructure, not a String.
<havenwood>
You can't send an OpenStruct as a String, unless you serialize it.
<havenwood>
beefjoe70: An OpenStruct is like a Hash, it's just less performant but fancier.
kmurphy4_ has joined #ruby
<beefjoe70>
so it's not json
bijan_ has joined #ruby
<havenwood>
When you initialize an OpenStruct, it internally defines methods on itself. That breaks the method lookup cache, which isn't great to do all the time.
<beefjoe70>
cause with it I can access using dot notation
<havenwood>
beefjoe70: An OpenStruct is unrelated to JSON.
<havenwood>
beefjoe70: JSON is a serialization format that is popular in many languages.
arashb has quit [Ping timeout: 240 seconds]
<havenwood>
beefjoe70: An OpenStruct is a Ruby-specific datatstructure that is unrelated to serliazation.
<havenwood>
beefjoe70: You could never use an OpenStruct, and that'd be fine.
<havenwood>
There are more use caveats with OpenStructs than with most things in Ruby. I'm more likely to use a Rinda::TupleSpace than an OpenStruct.
<havenwood>
beefjoe70: OpenStructs are fancy. They're fine to use, but usually Rubyists opt for a Struct or Hash instead
<apeiros>
hm, I thought rinda was part of drb - is that a gem?
ged_ is now known as ged
<havenwood>
apeiros: stdlib
<beefjoe70>
yea I'm going with json then, because I wanna work with the data using js
<apeiros>
what's the needed require? doesn't seem to be 'rinda'
<ged>
Does anyone know if it's possible to call back into Ruby from a non-ruby thread?
Cavallari has quit [Quit: Cavallari]
jrabe has quit [Quit: Disconnected]
chouhoulis has quit [Remote host closed the connection]
jottr has joined #ruby
bijan_ has joined #ruby
clemens3 has quit [Quit: WeeChat 2.1]
<dminuoso>
apeiros: I dont mind hierarchical module organization.
<dminuoso>
apeiros: But it's separate from identifier naming.
<dminuoso>
havenwood: Even JS does it...
<apeiros>
dminuoso: yes. the rdns stuff is not supposed to be part of the identifiers. but IMO it makes more sense to bind identifier to local symbols instead of tightly controlling import.
<dminuoso>
apeiros: Ive tried a few systems. Haskell got it right I think
<RougeR>
checks for pluralisation in rails controllers
<apeiros>
tightly controlling still can clash - when you want same named from two packages
<dminuoso>
apeiros: It allows you to pick identifiers, optionally or exclusively qualify them
jottr has quit [Ping timeout: 256 seconds]
<dminuoso>
Or you can do a blanket "all except" kind of import (which can be useful if you want short identifiers, but still need to avoid a nameclash with something you dont use)
<dminuoso>
JS is fairly close too
jrabe has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
UserOO7 has joined #ruby
UserOO7 has quit [Remote host closed the connection]
<dminuoso>
Java is kind of fine too
synthroid has quit [Remote host closed the connection]
arashb has joined #ruby
dionysus69 has quit [Quit: dionysus69]
aupadhye has quit [Ping timeout: 260 seconds]
coderphive has joined #ruby
Paweded has joined #ruby
synthroid has joined #ruby
conta has quit [Ping timeout: 256 seconds]
cyberg has quit [Ping timeout: 256 seconds]
Paweded has quit [K-Lined]
beefjoe70 has quit [Ping timeout: 256 seconds]
bijan_ has joined #ruby
jcarl43 has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bijan__ has joined #ruby
redlegion has quit [Remote host closed the connection]
bijan_ has quit [Ping timeout: 245 seconds]
redlegion has joined #ruby
cagomez has joined #ruby
bijan_ has joined #ruby
bijan__ has quit [Ping timeout: 276 seconds]
suukim has quit [Quit: Konversation terminated!]
AirDisa has joined #ruby
Zaab1t has joined #ruby
bijan__ has joined #ruby
tolerablyjake has joined #ruby
bijan_ has quit [Ping timeout: 260 seconds]
RougeR has quit [Ping timeout: 276 seconds]
AirDisa has quit [Remote host closed the connection]
<lupine>
dminuoso: well, it's kind of available at runtime too, but I'm not aware of any tools to parse it
AirDisa has joined #ruby
bijan__ has quit [Ping timeout: 245 seconds]
bijan_ has joined #ruby
<apeiros>
dminuoso: fun thing - if UnboundMethod wasn't so picky about its target, we could even implement all those things in the runtime
<dminuoso>
apeiros: Please no. If you dont believe me that dynamic features are evil; they are the reason we cant have a proper module system
<dminuoso>
they are the reason we cant have a proper type system, regardless of matz & co efforts
<dminuoso>
they are the reason we cant have efficient code gen
<dminuoso>
also they make it pretty hard to reason about code when staring at it
<apeiros>
true, if you want formally verifiable code, ruby is the wrong tool
<dminuoso>
and they make it hard to impossible to have good tooling
<apeiros>
that doesn't mean it's bad.
<apeiros>
it's just unsuited for a set of tasks.
bijan_ has quit [Read error: Connection reset by peer]
<dminuoso>
apeiros: If you check out Crystal. They offer typing, type inference, good code gen - and you can actually write tooling for it. The things you gain when you toss out dynamic features.
<dminuoso>
Meta programming by macros :P
<dminuoso>
But it still has the ruby feeling to it
<dminuoso>
anyway back to reading about profunctor optics
alfiemax has quit [Remote host closed the connection]
<kvoz>
Hi. Complete ruby noob here (never written a line of code) but been tasked with maintaining someone elses application, and I have been told I need to run rake db:migrate, but when I do I get "connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432", but thats not what my $DB_HOST variable says, I dont understand why its trying to connect to that db
bijan_ has quit [Read error: Connection reset by peer]
manjaroi3_ has quit [Ping timeout: 248 seconds]
manjaroi3_ has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bijan__ has quit [Ping timeout: 245 seconds]
amar has joined #ruby
conta has joined #ruby
Andrevan has joined #ruby
emilford has quit [Ping timeout: 260 seconds]
memo1 has quit [Ping timeout: 240 seconds]
emilford has joined #ruby
apeiros has quit [Remote host closed the connection]
bijan_ has joined #ruby
conta has quit [Ping timeout: 268 seconds]
alfiemax has joined #ruby
jrafanie has joined #ruby
Eiam has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
manjaroi3_ has quit [Ping timeout: 240 seconds]
emilford has quit [Ping timeout: 256 seconds]
emilford has joined #ruby
gizmore has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
bijan_ has joined #ruby
weird_error has joined #ruby
manjaroi3_ has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
majuk has joined #ruby
venmx has quit [Ping timeout: 240 seconds]
nima_m has quit [Quit: Connection closed for inactivity]
emilford has quit [Ping timeout: 260 seconds]
<manjaroi3_>
Hi. Complete ruby noob here (never written a line of code) but been tasked with maintaining someone elses application, and I have been told I need to run rake db:migrate, but when I do I get "connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432", but thats not what my $DB_HOST variable says, I dont understand why its trying to connect to that db
aupadhye has joined #ruby
mwlang has joined #ruby
nitric has quit [Ping timeout: 248 seconds]
ta_ has joined #ruby
<havenwood>
manjaroi3_: A Rails app I'm guessing from the Rake command? Check the file: config/database.yml
lytol has joined #ruby
<havenwood>
?rails manjaroi3_
<ruby[bot]>
manjaroi3_: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
emilford has joined #ruby
<manjaroi3_>
havenwood, will try there, thank you
<mwlang>
is there a gem out there supporting .Net’s signalr websockets? I’m having trouble tracking one down.
<majuk>
Hi all. I have an application I want to deploy on an ARM board [iMx6]. Unfortunately, my target board does not have enough horse-power to build the required gems itself [chokes specifically trying to build nokogiri]. My googling for guides to cross compile is taking me a lot of places I don't understand.
<majuk>
Any questions or comments are appreciated.
<mwlang>
majuk I can compile and build nokogiri gem on a 1st and 2nd edition Raspberry Pi
amar has quit [Remote host closed the connection]
<mwlang>
it may not be horse power of the arm board, but rather a lack of necessary system packages.
<havenwood>
majuk: Do you need Nokogiri specifically or just an XML parser?
<majuk>
mwlang: No, my board runs out of memory during the build process. I lost the exact error message, but I can recreate it.
<havenwood>
majuk: Oga is among the good alternatives.
ellcs has joined #ruby
Andrevan has quit [Quit: WeeChat 2.1]
hahuang65_ has joined #ruby
bijan_ has joined #ruby
hahuang65 has quit [Ping timeout: 245 seconds]
lxsameer has joined #ruby
<majuk>
havenwood: Nokogiri is required
amar has joined #ruby
jamiejackson has quit [Ping timeout: 256 seconds]
<havenwood>
majuk: I can't think of a way to get nokogiri compilation to use less memory.
<mwlang>
havenwood: You are the queen - that package indeed has a signalr client in it.
<havenwood>
majuk: are you hitting a ulimit or running out of system memory?
<havenwood>
majuk: have you tried using system libs?
<havenwood>
mwlang: hooah!
<majuk>
havenwood: System memory IIRC. I'm recreating the error message as we speak but it will take another ~10 minutes for the process to give up.
<gizmore>
what is usually better, preferring symbols or strings as hashmap keys? .... i am thinking of avoiding symbols in favor of mysql2 returns stringed hashmaps
hotpancakes has joined #ruby
bijan__ has joined #ruby
bijan_ has quit [Ping timeout: 256 seconds]
mostlybadfly has quit [Quit: Connection closed for inactivity]
norfumpit has quit [Read error: Connection reset by peer]
<havenwood>
gizmore: What kind of text? Have any examples?
<gizmore>
column names
lxsameer has quit [Ping timeout: 260 seconds]
<havenwood>
gizmore: I'd probably use Symbols for those. Symbols are generally preferred for Hash keys, and column names should look nice as Symbols.
guille-moe has quit [Remote host closed the connection]
bijan_ has joined #ruby
bijan__ has quit [Ping timeout: 256 seconds]
<gizmore>
havenwood: yeah.... maybe there is an option in mysql2 gem to return symbols as keys
<havenwood>
gizmore: it's fine to use String Hash keys as well
<mwlang>
gizmore: sequel gem will let you interact with the DBMS with ruby hashes.
ramfjord has joined #ruby
lxsameer has joined #ruby
guille-moe has joined #ruby
<mwlang>
and with that library, it’s all symbols instead of strings.
<gizmore>
i am working on my own dba :)
nowhere_man has quit [Ping timeout: 256 seconds]
<mwlang>
ok, gotcha. FWIW, I prefer symbols for hash keys over strings.
<havenwood>
<3 Sequel
<havenwood>
gizmore: look at Sequel's plugin system
<gizmore>
i am fine.... but it probably is worth a look
bijan_ has quit [Ping timeout: 240 seconds]
<mwlang>
I learned a lot of good Ruby tricks from the Sequel source. Definitely worth a study.
<gizmore>
i also did my own autoloader... it just replaces :: with /
<gizmore>
in missing constants... works charmy
<mwlang>
neat idea.
cyberg has quit [Ping timeout: 240 seconds]
<mwlang>
where do you hook the autoloader in?
<gizmore>
module GDO
ellcs has quit [Ping timeout: 248 seconds]
cadillac_ has quit [Ping timeout: 256 seconds]
<gizmore>
only own classes are loaded that way
lxsameer has quit [Ping timeout: 240 seconds]
bijan_ has joined #ruby
aupadhye has quit [Ping timeout: 256 seconds]
chouhoulis has joined #ruby
thapakazi has quit [Ping timeout: 248 seconds]
nitric has joined #ruby
cadillac_ has joined #ruby
eelster has joined #ruby
ta__ has joined #ruby
lxsameer has joined #ruby
bijan__ has joined #ruby
bijan_ has quit [Read error: Connection reset by peer]
ta_ has quit [Ping timeout: 276 seconds]
nitric_ has joined #ruby
bijan__ has quit [Read error: Connection reset by peer]
p0p0pr37_ has joined #ruby
p0p0pr37_ has joined #ruby
p0p0pr37_ has quit [Changing host]
nitric has quit [Ping timeout: 260 seconds]
Jiaoyin has joined #ruby
<Jiaoyin>
..hey guys, I was helping, I can get some tips
<Jiaoyin>
..advice
lxsameer has quit [Ping timeout: 256 seconds]
<Jiaoyin>
Correct me if I'm wrong, but a hash is a associative array, right? When you create a hash you use {curly braces}, but when you want to use the key of a hash, you’re using [square brackets].
<Jiaoyin>
???
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
<gizmore>
Jiaoyin: the [] function is to access values of the hash... use hash[key] to read a value
guille-moe has quit [Ping timeout: 240 seconds]
<gizmore>
use hash[key]= to set a value
<mwlang>
I don’t know if “associative array” is correct term for a Hash. key/value mapping seems more appropriate.
bijan_ has joined #ruby
<havenwood>
Jiaoyin: You're right, a Hash is a dictionary. Hash#[] is one Hash method for retrieving the value for the specified key. There's a little bit of syntactic sugar that let's you call it like `h[arg]` instead of `h.[](arg)`.
<Jiaoyin>
If a hash for txt is {"txt"=>14}. The key for the hash is 14? To get the hash 14, you type in....[txt]. Correct?
<havenwood>
Jiaoyin: The hash is `{"txt"=>14}`. It has one key/value pair. The one key is `"txt"`. The one value is `14`.
mikecmpbll has joined #ruby
<Jiaoyin>
I'm still on the first week and I'm trying to understand the hash and key....that's why I ask
<Jiaoyin>
Oh...
<Jiaoyin>
I see
<Jiaoyin>
thanks
<Jiaoyin>
that makes alot more sense
<Jiaoyin>
I appreciate it :)
russt has quit [Remote host closed the connection]
russt has joined #ruby
<havenwood>
mwlang: I think it is the right overarching term. Hash, dictionary and map are all just different names for associative arrays, which can be implemented any which way.
<Jiaoyin>
I thought 'txt' was the hash. Didn't know the whole thing inside the {} was the actual hash.
hotpancakes has quit [Remote host closed the connection]
<Jiaoyin>
thanks again
<havenwood>
mwlang: Though I do have a bit of a bad taste re "associative array" because of PHP. ;-P
<mwlang>
havenwood: that may be it for me as well.
lxsameer has quit [Ping timeout: 245 seconds]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
guacamole has joined #ruby
guacamole has joined #ruby
guacamole has quit [Changing host]
nk121 has joined #ruby
<Jiaoyin>
.......btw, I just notice you used used ' instead of "............why is that?
<Jiaoyin>
...is it just a preference thing?
lxsameer has joined #ruby
Guest9512 has quit [Quit: ZNC 1.6.6 - http://znc.in]
<havenwood>
Jiaoyin: You mean the backticks I put around code, like `1 +1` or something else?
<havenwood>
Jiaoyin: I don't understand what you're asking. ¯\_(ツ)_/¯
<havenwood>
Jiaoyin: Oh, you mean single instead of double quote?
<Jiaoyin>
..when you were replying to me just a while ago, you said................The one key is `"txt"`. The one value is `14`.........................is their a reason why you said '"txt"' instead of 'txt' or just "txt"
<Jiaoyin>
???
<havenwood>
Jiaoyin: I'm using the convention where you always surround code used inline in sentences with backticks.
<havenwood>
Jiaoyin: They're not single quotes, they're backticks.
sauvin has quit [Remote host closed the connection]
<Jiaoyin>
I see the number, but how are these number calculated? I mean, how is it that 'Jiaoyin'.hash.....................brings up 481165061 ...........where as {"txt"=>14}.hash ...........brings up 1017606070
<Jiaoyin>
what hashing algorithm is it using?....if it's using any
<Jiaoyin>
Just curious how these hashes are being generated..
lxsameer has joined #ruby
\void has joined #ruby
phaul has quit [Ping timeout: 276 seconds]
banisterfiend has joined #ruby
phaul has joined #ruby
<havenwood>
There's an algorithm called SipHash 13 that Ruby uses.
<Jiaoyin>
..............is their a online conversion tool? Let's say I get the siphash 481165061.............how I want to flip it back.........unhash or unencrypt it
<Jiaoyin>
how do I do that?
<mwlang>
why switch from SipHash24 to 13? performance?
<havenwood>
mwlang: aye, performance
lxsameer has joined #ruby
<Jiaoyin>
..and, how do I check what algorithm Ruby is using for the hashing...using the irb?
ellcs has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
\void has joined #ruby
<havenwood>
Jiaoyin: You'd have to check the Ruby source code to see that implementation detail.
<Jiaoyin>
k
<havenwood>
Jiaoyin: Most Rubyists don't know what SipHash 13 is nor care.
<Jiaoyin>
Is their a online conversion tool out there?
lxsameer has quit [Ping timeout: 245 seconds]
<havenwood>
Jiaoyin: You can't get from that hash number back to the object. It doesn't correspond like an object_id does.
<havenwood>
Jiaoyin: It's being produced by a cryptographic function that was designed not to leak information.
<Jiaoyin>
...unless without the key?
<havenwood>
Jiaoyin: An object_id on the other hand corresponds to the object's location in memory, and is simple enough to easily reverse engineer.
<havenwood>
Jiaoyin: Read the SipHash 2-4 paper. ;-P
<havenwood>
I should do a SipHash 1-3 implementation in pure Ruby. That sounds fun.
lxsameer has joined #ruby
<Jiaoyin>
You should :)
codymj has joined #ruby
sent-hil has quit [Quit: Connection closed for inactivity]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Jiaoyin>
I looked through the pdf file and the rb file. It doesn't have anything on how to check what hashing algrithom your version of ruby has. Is their a way I can check this under the irb?
banisterfiend has joined #ruby
<havenwood>
Jiaoyin: No, it's an implementation detail. As a Ruby user, it's not going to make any difference to you.
<Jiaoyin>
..something to type in the irb...............so it spits out something like, "You're using the hashing algorithm SipHash13"
<havenwood>
Jiaoyin: Nope, nothing like that.
<Jiaoyin>
I se, alright
<Jiaoyin>
see*
cyberg has quit [Ping timeout: 240 seconds]
<havenwood>
Jiaoyin: Maybe if you can somehow embed the #ruby channel in your irb.
nowhere_man has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
bijan_ has quit []
hotpancakes has joined #ruby
lxsameer has joined #ruby
manjaroi3_ has quit [Ping timeout: 260 seconds]
cyberg has joined #ruby
Zaab1t has quit [Quit: Zaab1t]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
lxsameer has quit [Ping timeout: 248 seconds]
nowhere_man has quit [Ping timeout: 248 seconds]
ramfjord has joined #ruby
cagomez has quit [Ping timeout: 248 seconds]
CrazyEddy has quit [Remote host closed the connection]
hotpancakes has quit [Remote host closed the connection]
hotpancakes has joined #ruby
lxsameer has joined #ruby
dreamthese has quit [Remote host closed the connection]
dreamthese has joined #ruby
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
cyberg has quit [Ping timeout: 260 seconds]
manjaroi3_ has joined #ruby
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
KeyJoo has joined #ruby
<Jiaoyin>
..how do you embed the ruby channel in the IRB?..lol
lxsameer has quit [Ping timeout: 248 seconds]
Andrevan has joined #ruby
alfiemax_ has joined #ruby
jrafanie_ has joined #ruby
<majuk>
Is there a way to have bundler report the gems it thinks are required by a Gemfile?
cagomez has joined #ruby
jrafanie has quit [Ping timeout: 240 seconds]
alfiemax has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
<z64>
is a lockfile not suitable?
<majuk>
z64: Ah, I think that's what I'm looking for. Thanks.
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rfoust has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<z64>
FWIW, you can generate a lockfile or print it to STDOUT with `bundle lock` (see --help)
<z64>
np
<z64>
(bundle lock wont actually install the gems)
cagomez has quit [Ping timeout: 268 seconds]
<majuk>
Cool, I'll look at that. It seems my earlier memory issue is local to bundler as using `gem install` outside bundler was able to install [most] of the necessary gems.
<z64>
o
<majuk>
That's a comment towards general chat, not specifically you z64
lxsameer has quit [Ping timeout: 276 seconds]
banisterfiend has joined #ruby
eblip has joined #ruby
RougeR has quit [Ping timeout: 240 seconds]
ellcs has quit [Ping timeout: 240 seconds]
jottr has joined #ruby
lxsameer has joined #ruby
cyberg has joined #ruby
alfiemax has joined #ruby
ellcs has joined #ruby
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
nowhere_man has joined #ruby
coderphive has quit [Quit: coderphive]
alfiemax_ has quit [Ping timeout: 256 seconds]
banisterfiend has quit [Remote host closed the connection]
<Eiam>
Jiaoyin: I can't tell if that was a serious question or not...
coderphive has joined #ruby
jottr has quit [Ping timeout: 276 seconds]
cagomez has quit [Ping timeout: 240 seconds]
cyberg has quit [Ping timeout: 256 seconds]
lxsameer has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
bogdan has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
alfiemax has joined #ruby
phaul has quit [Ping timeout: 260 seconds]
lxsameer has joined #ruby
memo1 has joined #ruby
ski7777 has quit [Read error: Connection reset by peer]
jatto has joined #ruby
ski7777 has joined #ruby
cagomez has joined #ruby
eelster has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eblip has quit [Quit: WeeChat 2.0.1]
RougeR has quit [Ping timeout: 244 seconds]
lxsameer has quit [Ping timeout: 255 seconds]
agent_white has joined #ruby
p0p0pr37_ has joined #ruby
p0p0pr37_ has joined #ruby
p0p0pr37_ has quit [Changing host]
cyberg has joined #ruby
amar_ has joined #ruby
p0p0pr37 has quit [Ping timeout: 260 seconds]
phaul has joined #ruby
p0p0pr37_ is now known as p0p0pr37
lxsameer has joined #ruby
amar has quit [Ping timeout: 248 seconds]
cyberg has quit [Ping timeout: 244 seconds]
lxsameer has quit [Ping timeout: 260 seconds]
<mwlang>
havenwood: embed #ruby irc channel in irb console!? You gotta build that! I can just see it now…an interactive Ruby shell that emits IRC messages as they come through while you’re working on something…and you can reply back with simple command => irc :ruby, “yeah, I got it.”
jcalla has quit [Quit: Leaving]
alfiemax has quit [Remote host closed the connection]
<mwlang>
for any of you that are into crypto currencies and trading on exchanges, I put out a new open source gem that wraps cobinhood’s api: https://github.com/mwlang/cobinhood I’d love some feedback on how to improve this code (aside from the most obvious: writing some specs for it…)
bogdan has quit [Quit: bogdan]
tolerablyjake has joined #ruby
lxsameer has joined #ruby
banisterfiend has joined #ruby
ta_ has joined #ruby
<mwlang>
speaking of writing specs, for open source projects that may have sensitve server exchanges, what’s the typical approach to implementing? last thing I want to do is accidentally expose my private API keys through VCR cassettes and/or other means of fixture capturing.
cyberg has joined #ruby
sagax has quit [Quit: Konversation terminated!]
jcalla has joined #ruby
lxsameer has quit [Ping timeout: 276 seconds]
eckhardt has joined #ruby
guacamole has joined #ruby
guacamole has joined #ruby
guacamole has quit [Changing host]
dreamthese has quit [Remote host closed the connection]
lxsameer has joined #ruby
dreamthese has joined #ruby
<havenwood>
mwlang: I'd suggest inheriting from StandardError instead of Exception.
<havenwood>
mwlang: Frozen string literal magic comment is fairly mainstream these days.
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
mwlang: I'd suggest using ENV::fetch instead, to raise an error if the env var is missing, rather than have it be `nil` and percolate up elsewhere.
<mwlang>
Good points on all, but I didn’t understand one: Frozen string literal magic comment?
cagomez has quit []
<havenwood>
mwlang: On the first line of the file: # frozen_string_literal: true
<havenwood>
mwlang: It'll autofreeze all the Strings as if you ran Ruby with: --enable-frozen-string-literal
<mwlang>
Ah! That’s a new feature to me.
lxsameer has quit [Ping timeout: 240 seconds]
<mwlang>
does it go in every file or just the primary lib/cobinhood.rb file?
<havenwood>
at the top of each Ruby file
apeiros_ has joined #ruby
<havenwood>
most popular libraries are just adding it across the board
<mwlang>
what’s practically gained from freezing all the literal strings?
<apeiros>
havenwood: neither does =~, they're set lazily
<apeiros>
or at least that's how I learned it ages ago :D
<havenwood>
match? ends up being a really nice performance improvement
<apeiros>
eh, duly noted
<havenwood>
apeiros: Rails switched String#blank? from #=~ to #match? and now it's as fast as the fast_blank C ext
<mwlang>
learnt a couple of something new today!
kapil___ has quit [Quit: Connection closed for inactivity]
<apeiros>
interesting
<mwlang>
I’ve been using !~ and =~ for quite some time just because I like it better than reading “match?” but an performance boost is enough for me to change.
lxsameer has quit [Ping timeout: 260 seconds]
<mwlang>
truth be told, most time lost on the actual API call/response than anywhere else.
<mwlang>
havenwood: thanks for that detailed look and feedback. I definitely wasn’t expecting that and really appreciate it. I’m probably going to do a few more of these for various exchanges, esp. if the current ones out there royally suck like the cobinhood_api one did.
cliluw has quit [Read error: Connection reset by peer]
<mwlang>
kucoin comes to mind. terrible implementation of a ruby wrapper on the existing gem.
banisterfiend has joined #ruby
biox has quit [Quit: probably server crash]
lxsameer has quit [Ping timeout: 260 seconds]
biox has joined #ruby
hotpancakes has quit [Remote host closed the connection]
cliluw has joined #ruby
<mwlang>
one other performance idea: someone told me to switch the Faraday default adapter to Typhoeus. any opinions here on the merits of that suggestion?
amar has joined #ruby
samosaphile has quit [Ping timeout: 260 seconds]
memo1 has joined #ruby
amar_ has quit [Ping timeout: 244 seconds]
lxsameer has joined #ruby
kmurphy4_ is now known as kmurphy4
zleap has quit [Changing host]
zleap has joined #ruby
tdy has joined #ruby
<mwlang>
hmmm…are you sure about “ ENV::[] always returns a String” ? I just tried this in IRB console: ENV["SOMETHING"] => nil
t0xik has joined #ruby
dviola has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
mwlang: always returns a string +for existing keys+
<apeiros>
nonexistent keys will return nil, yes
<Eiam>
you could do ENV["SOMETHING"] ||= :emptyEnv
<mwlang>
apeiros: thanks for clarifying.
<Eiam>
in which case you'll always get something =0
<mwlang>
I just simply did ENV[“SOMETHING”].to_s
<mwlang>
:-)
<Eiam>
eh, now you are encoding an empty string to mean state
<Eiam>
but w/e its your code.
cliluw has quit [Ping timeout: 256 seconds]
<mwlang>
but you know…better idea is to change where I call #to_s
<mwlang>
if only nil.empty? => true
lxsameer has joined #ruby
<Eiam>
#rubyonrails is that way
<mwlang>
all I needed to know at the point of using an api_key is whether it was blank/empty or not.
<mwlang>
*sigh* any ideas they *didn’t* bolt on?
<mwlang>
rails is a two-edged sword, for sure.
<Eiam>
you can check length if you don't feel like writing an or... ?
ta_ has joined #ruby
<Eiam>
as long as you .to_s it like you said first, you'll get 0
emilford has quit [Ping timeout: 256 seconds]
<mwlang>
that’s all I really need. sweet and simple.
majuk has quit [Remote host closed the connection]
bipul has quit [Read error: Connection reset by peer]
skeeba has quit [Read error: Connection reset by peer]
<Jiaoyin>
@mwlang I just saw your post about cobinhood..lol. I was one of the few original investors
<Jiaoyin>
.....what's the program about?
<Jiaoyin>
the one you're trying to write..
bipul has joined #ruby
<mwlang>
@Jiaoyin original investor as in pre-pre ICO investor? :-o
<mwlang>
@Jiaoyin What I produced is just Ruby API wrappers to the Cobinhood API
<mwlang>
I needed it for algorithimic trading bots I’m building.
<Jiaoyin>
I was in the ICO during around the time when they had the problem with EtherDelta
<Jiaoyin>
..and it went crashing..lol
<mwlang>
Ah. I’ve been a long-term “investor” from point of view of simply holding and growing COB stack simply trading the gap in the spreads on the platform.
<Jiaoyin>
that's kool
<mwlang>
trying to automate what I’ve been doing manually until now.
<Jiaoyin>
I'm currently learning Ruby so hearing about your code.....caught my attention
<mwlang>
Ah. welcome to the Ruby community.
<Jiaoyin>
Thanks :)
<Jiaoyin>
Do you think Cobinhood is going to hold up? I'm hearing a ton of problems with RobinHood..ahaha
<mwlang>
If you’re into cryptocurrencies, you may also like another open source Ruby project I have going: https://github.com/mwlang/crypto
<mwlang>
I do. They seem to have a great team and constantly working on improving the platform.
cagomez has joined #ruby
<mwlang>
their marketing needs help, but they’re getting better there.
<Jiaoyin>
I see
<Jiaoyin>
Looks like you got some good projects going.
tvw has quit [Remote host closed the connection]
<Jiaoyin>
Still learning so I will look over it again once I get better at Ruby.
<mwlang>
they’re fun and keeps me busy.
<cagomez>
How do I set `email` key to an empty string if the key exists? {'email'=> nil}.reverse_merge('email' => 'foo')
d^sh has quit [Ping timeout: 248 seconds]
<Jiaoyin>
Goodluck with your project
memo1 has quit [Ping timeout: 244 seconds]
d^sh has joined #ruby
<mwlang>
Jiaoyin: thanks! you, too.
hotpancakes has quit [Ping timeout: 244 seconds]
emilford has quit [Ping timeout: 256 seconds]
emilford has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
dinfuehr has quit [Ping timeout: 256 seconds]
dinfuehr has joined #ruby
dviola has quit [Quit: WeeChat 2.1]
lxsameer has joined #ruby
emilford has quit [Ping timeout: 260 seconds]
emilford has joined #ruby
brianpWins has left #ruby [#ruby]
clemens3_ has quit [Ping timeout: 260 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
emilford has quit [Ping timeout: 260 seconds]
sanscoeu_ has joined #ruby
willmichael has joined #ruby
cagomez has quit [Remote host closed the connection]
hotpancakes has joined #ruby
hotpancakes has quit [Remote host closed the connection]
emilford has joined #ruby
cagomez has joined #ruby
sanscoeur has quit [Ping timeout: 248 seconds]
TomyLobo has quit [Ping timeout: 256 seconds]
sanscoeu_ has quit [Ping timeout: 256 seconds]
venmx has quit [Ping timeout: 240 seconds]
dbugger_ has quit [Ping timeout: 240 seconds]
grilix_ has quit [Ping timeout: 256 seconds]
brianpWins has joined #ruby
ramfjord has quit [Ping timeout: 268 seconds]
AJA4350 has quit [Quit: AJA4350]
willmichael has quit [Ping timeout: 256 seconds]
ramfjord has joined #ruby
cschneid has quit [Remote host closed the connection]
cschneid has joined #ruby
lytol has quit [Remote host closed the connection]
<baweaver>
Ah foo with that. I've done ops for years, it's plenty real software
lxsameer has quit [Ping timeout: 256 seconds]
willmichael has joined #ruby
<baweaver>
and starting in July I'm going back to ops
<baweaver>
or SRE, or DevOps, or whatever in the world else they call it these days.
<havenwood>
Snow Removal Engineer
<baweaver>
Anyways, point being automation is real software. If it's written in a programming language it's real software.
<havenwood>
and people who write programs are programmers!
<baweaver>
Too many gate keepers wanting to sound high and mighty, honestly. Just ignore them.
<havenwood>
baweaver: I agree.
<baweaver>
Though [] is technically "call" for procs
<baweaver>
screwy, no?
trevoke has joined #ruby
cschneid has joined #ruby
<trevoke>
Hi all, I've got a doozy of a question. Is it possible to dynamically define named parameters for the instantiation of a new object? In essence, I _think_ I'm asking if I can dynamically define named parameters for an overridden class-level new method, so I _think_ I'm asking about passing dynamic names as block arguments to define_method and define_singleton_method but I could absolutely be wrong...
<baweaver>
#1 and #2 are kinda flawed premises. Call is a method on a function, and functions should have arguments.
<trevoke>
You're suggesting that I can do something like `define_singleton_method(:new) do |instance_eval(x):|` ?
mikecmpbll has quit [Client Quit]
p0p0pr37_ has joined #ruby
p0p0pr37_ has joined #ruby
p0p0pr37_ has quit [Changing host]
<trevoke>
Yeah. I also realized that I need to implement ===(foo) if I want it to be usable fully like a proc or some other object so I need to make changes to that.
jcarl43 has quit [Quit: WeeChat 2.1]
karapetyan has quit [Remote host closed the connection]
p0p0pr37 has quit [Ping timeout: 240 seconds]
p0p0pr37_ is now known as p0p0pr37
csk157 has joined #ruby
<trevoke>
**kwargs is the splat operator, it's what I'm currently using and I don't really get named arguments that way -- not pure anyway. I can fake it the way I am now and I could even raise the same error Ruby is raising if I wanted, but I don't know what to do with that otherwise. I don't know where to plug in the instance_eval - I know I can do `define_singleton_method(:new) do |x:|` and that'll work, but of course that's a hardcoded name
<trevoke>
parameter.
rfoust has quit [Ping timeout: 240 seconds]
<trevoke>
Oh.. You're saying to use instance_eval and eval the string
cajone has quit [Ping timeout: 244 seconds]
<trevoke>
Ugh, I don't know if that's dirtier than I want to go.
csk157 has quit [Ping timeout: 260 seconds]
lxsameer has joined #ruby
<ramfjord>
sweet jesu that
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]