masterasia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul>
hays: so you would like to have dp_key_calc in the module as both instance and class methods. One way _not the best_ is to extend the module with self.
<phaul>
module DPKeyCalc; extend self; ..; end
<phaul>
that would at least make it work
<hays>
generally speaking im having a hard time understanding how to modularize my code in rubyoutside a very strict OOP paradigm. maybe that's on purpose
<phaul>
Ruby usually lets you modularize and DRY up the code fairly well in my opinion.
nakuku has joined #ruby
<phaul>
The extend self has the side effect of every instance method becoming class method. If you are happy with that then, go for it.
<hays>
generally speaking im having a hard time understanding how to modularize my code in rubyoutside a very strict OOP paradigm. maybe that's on purpose
<hays>
ack sorry to repeat
<hays>
typo
<phaul>
I think pulling methods out to Modules to modularize and DRY is generarily a good idea. Many projects follow that design. Most of Rails does. But they call it concerns and they do it with some helpers
<nakuku>
And there will be some shared business logic, but i think two services are fine dont you think? And shared business logic should then reside in its own service and can be used in both of these services.
masterasia has joined #ruby
donofrio has joined #ruby
lxsameer has quit [Ping timeout: 268 seconds]
dviola has quit [Ping timeout: 245 seconds]
lytol has joined #ruby
mads2 has quit [Remote host closed the connection]
graphene has quit [Remote host closed the connection]
donofrio has quit [Ping timeout: 250 seconds]
graphene has joined #ruby
cd has quit [Quit: cd]
mads2 has joined #ruby
<mboekhoff>
What do people here think of Roda?
phaul has quit [Quit: bye]
<nakuku>
mboekhoff: Never used it. I know my friend extraced parts of a huge app to roda and saw dramatical performance gain.
<nakuku>
But that's not surprising i guess :D
TomyLobo has quit [Read error: Connection reset by peer]
jcalla has joined #ruby
gix has quit [Ping timeout: 250 seconds]
hutch has joined #ruby
arescorpio has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
tiff has joined #ruby
nchambers has joined #ruby
nchambers has quit [Client Quit]
nakuku has quit [Remote host closed the connection]
bambanx has joined #ruby
yokel has quit [Remote host closed the connection]
RougeR has quit [Ping timeout: 240 seconds]
yokel has joined #ruby
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arescorpio has quit [Remote host closed the connection]
tiff has joined #ruby
mboekhoff has quit [Ping timeout: 250 seconds]
kapil____ has joined #ruby
ansraliant has joined #ruby
themsay has joined #ruby
sylario has quit [Quit: Connection closed for inactivity]
nchambers has joined #ruby
carbone5 has joined #ruby
masterasia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
carbone5 has quit [Client Quit]
houhoulis has quit [Remote host closed the connection]
carbone5 has joined #ruby
masterasia has joined #ruby
masterasia has quit [Client Quit]
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tiff has joined #ruby
Swyper has joined #ruby
Swyper has quit [Client Quit]
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
carbone5 has quit [Quit: carbone5]
carbone5 has joined #ruby
AJA4350 has quit [Quit: AJA4350]
carbone5 has quit [Quit: carbone5]
carbone5 has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
carbone5 has quit [Quit: carbone5]
bambanx has quit [Quit: Leaving]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
spacesuitdiver has joined #ruby
spacesuitdiver has quit [Client Quit]
Emmanuel_Chanel has quit [Ping timeout: 246 seconds]
Emmanuel_Chanel has joined #ruby
orbyt_ has joined #ruby
cnsvc_ has joined #ruby
braincrash has quit [Quit: bye bye]
hutch has quit [Ping timeout: 268 seconds]
JoshS has joined #ruby
braincrash has joined #ruby
JoshS has quit [Remote host closed the connection]
pavelz has quit [Quit: leaving]
roshanavand1 has joined #ruby
roshanavand has quit [Ping timeout: 264 seconds]
roshanavand1 is now known as roshanavand
pavelz has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roshanavand has quit [Remote host closed the connection]
hutch has joined #ruby
<KrzaQ>
let's say I have n = 4; what do I .send to n to assign to it? n.send(:=, 42) doesn't work
<KrzaQ>
I'm trying to generate methods for yesterday's advent of code riddle
<KrzaQ>
it seems all other operators work like that, but not this one
<leftylink>
that sounds like `become` in Smalltalk, but I'm not convinced `become` exists in Ruby
<leftylink>
note that a `send` is going to be sent to the object representing `4` not `n`, so I'd be surprised if a `send` has the power to change the binding
<KrzaQ>
oh, so that's how it works
<KrzaQ>
no wonder it doesn't have the power to do this
<KrzaQ>
any idea how I can approach this, though?
davidw has quit [Ping timeout: 244 seconds]
<leftylink>
hmm. ok, so I just found that `ruby -e 'a = 5; binding.local_variable_set(:a, 100); puts a'` prints 100, so that is one possible? (https://ruby-doc.org/core-2.4.0/Binding.html)
<leftylink>
s/one possible/one possible way of making something happen/
<leftylink>
may not be as clean as hoped for though
za1b1tsu has quit [Remote host closed the connection]
themsay has quit [Ping timeout: 250 seconds]
ByronJohnson has quit [Ping timeout: 250 seconds]
za1b1tsu has joined #ruby
code_zombie has quit [Quit: Leaving]
dbz has joined #ruby
serard has joined #ruby
JoshS has quit [Quit: Leaving]
tiff has joined #ruby
tiff has quit [Client Quit]
serard_ has quit [Quit: Leaving]
\void has quit [Quit: So long, and thanks for all the fish.]
serard has quit [Quit: Leaving]
kapil____ has quit [Quit: Connection closed for inactivity]
keden has joined #ruby
mikecmpbll has joined #ruby
mboekhoff has quit [Quit: WeeChat 2.2]
nowhere_man has joined #ruby
za1b1tsu has quit [Ping timeout: 240 seconds]
roshanavand has quit [Quit: Gone planting!]
ByronJohnson has joined #ruby
mikecmpbll has quit [Ping timeout: 268 seconds]
roshanavand has joined #ruby
KeyJoo has quit [Quit: KeyJoo]
tiff has joined #ruby
keden has quit [Ping timeout: 250 seconds]
za1b1tsu has joined #ruby
stooj has quit [Ping timeout: 244 seconds]
sylario has joined #ruby
stooj has joined #ruby
clemens3 has joined #ruby
phaul has joined #ruby
Freshnuts has quit [Quit: Leaving]
dbz has quit [Remote host closed the connection]
<phaul>
KrzaQ: there are mutable types, and there are non mutable types. Integer is not mutable. It boils down to the interpreter optimizing the normal object behavour out and using actual numbers rather than object pointers.
dbz has joined #ruby
venmx has joined #ruby
ellcs has joined #ruby
vondruch has joined #ruby
keden has joined #ruby
Azure has quit [Read error: Connection reset by peer]
dbz has quit [Remote host closed the connection]
cnsvc_ has quit [Ping timeout: 256 seconds]
za1b1tsu has quit [Read error: Connection reset by peer]
dbz has joined #ruby
serard has joined #ruby
za1b1tsu has joined #ruby
dbz has quit [Ping timeout: 246 seconds]
Milos has joined #ruby
ellcs has quit [Ping timeout: 250 seconds]
clemens3 has quit [Ping timeout: 246 seconds]
blackmesa has joined #ruby
cnsvc_ has joined #ruby
clemens3_ has joined #ruby
ellcs has joined #ruby
conta has quit [Ping timeout: 250 seconds]
roshanavand has quit [Remote host closed the connection]
Bish has joined #ruby
roshanavand has joined #ruby
dinfuehr has quit [Ping timeout: 268 seconds]
cnsvc_ has quit [Ping timeout: 256 seconds]
dinfuehr has joined #ruby
ellcs has quit [Ping timeout: 250 seconds]
conta has joined #ruby
aupadhye has quit [Ping timeout: 252 seconds]
Azure has joined #ruby
dirceu has joined #ruby
venmx has quit [Ping timeout: 245 seconds]
dirceu has quit [Quit: Leaving]
aupadhye has joined #ruby
za1b1tsu has quit [Ping timeout: 246 seconds]
nakuku has joined #ruby
<nakuku>
Can unit test hit the database? It only contains repository.update call with some parameters. Should i call it a "test" and go home. Or i need to mock the thing to call it "unit test" and write integration test to confirm it
serard has quit [Ping timeout: 252 seconds]
kidPalooma has joined #ruby
<kidPalooma>
Hello, how do I generate a random sequence of lowercase letters in ruby? It needs to be only letters and lowercase
horst has quit [Read error: Connection reset by peer]
horst has joined #ruby
<kidPalooma>
thanks phaul
<phaul>
yw
<phaul>
some would argue that we should use 'a' instead of ?a (they are the same), but I have nothing against the ? notation
<kidPalooma>
I don't mind it either
aufi has quit [Read error: Connection reset by peer]
keden has quit [Ping timeout: 250 seconds]
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aufi has joined #ruby
ellcs has quit [Ping timeout: 250 seconds]
lxsameer has joined #ruby
za1b1tsu has joined #ruby
deathwishdave has joined #ruby
keden has joined #ruby
kidPalooma has quit [Ping timeout: 256 seconds]
<jhass>
phaul: well that solution might not be what they want as it doesn't allow for reoccurence of any letter and thus limits the space of possible sequences quite a bit
<jhass>
because before ruby 1.9 String#[] used to return the codepoint, and so did ?a then allowing for a quick way to check if a particular character is at a particular position in a string
<jhass>
with 1.9 String#[] started to return a single character string and thus ?a was updated to represent that too to not break existing code in a subtle way
<jhass>
but at the same time that change made the syntax quite obsoelete, which is why many frown on it
AJA4350 has joined #ruby
<phaul>
I see.
<phaul>
jhass: do you have a quick one liner for their question?
<jhass>
I guess I'd gobble together Array.new and sample, so CHARSET = [*'a'..'z']; Array.new(10) { CHARSET.sample }.join
roshanavand has quit [Remote host closed the connection]
<phaul>
nice
<jhass>
or just "".yield_self {|s| 10.times { s << CHARSET.sample } }
<jhass>
either is really pretty tbh
<jhass>
eh, isn't
<jhass>
usually those requirements come from generating some kind of opaque ID which you often can do quite nicely with an idea modulo some large prime and base36'ing the result
<jhass>
with an ID I mean, dunno what's wrong with me today
<phaul>
hm.
<jhass>
so it looks random to the user but knowing the prime you can go back in constant time
cnsvc_ has joined #ruby
roshanavand has joined #ruby
<phaul>
interesting that they decided to implement #sample this way, as I am speculating it's actually more difficult to ensure choosing unique indices, and moreover we could already get this by doing #shuffle.take(10)..
InfinityFye has joined #ruby
<jhass>
I actually love it, I needed that behaviour more often than the other
<jhass>
and it's much harder to reimplement efficiently
<jhass>
.shuffle.take just breaks down once your input collection is big
<phaul>
i see. So it's there for performance reasons
<jhass>
well I can only speculate but I would on more commonly useful and harder to do efficient compared to reimplementing the other behaviour efficiently
go|dfish has joined #ruby
jottr has joined #ruby
DTZUZO has joined #ruby
al2o3-cr-tmp has joined #ruby
al2o3-cr is now known as Guest27748
al2o3-cr-tmp is now known as al2o3-cr
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jcalla has quit [Ping timeout: 240 seconds]
paranoicsan has joined #ruby
marz_d`ghostman has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
beef_erikson has joined #ruby
al2o3-cr has quit [Ping timeout: 246 seconds]
cow[away] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
cow[moo] is now known as cow[away]
<marz_d`ghostman>
I'm using the sqlite3 gem, Is it possible to like flush a statement so I could like create a table and then insert data in one SQLite3::Database.open?
<marz_d`ghostman>
Like inside a SQLite3::Database.open(file) . .. I'm creating a table then pushing data. I'd like to push the creation of the table first. Is that possible though?
<darix>
marz_d`ghostman: what makes you think it hasnt happened instantly?
<marz_d`ghostman>
darix: cause I when I do a get query, no records are returned, tried to manually query it via irb and sqlite3 on cli
<darix>
uhm
<darix>
you need to provide a script for reproducer
nowhere_man has quit [Ping timeout: 252 seconds]
<marz_d`ghostman>
darix: So, I've created a initialize.rb to run first before my main script for database population: e21d499b15ddb9bf05e6030facdec7b8
<darix>
marz_d`ghostman: should the hash like string at the end be an url maybe?
<marz_d`ghostman>
darix: what do you mean?
<darix>
see your last line
cnsvc_ has joined #ruby
<marz_d`ghostman>
darix: the INSERT line?
cow[away] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<marz_d`ghostman>
darix: It doesn't trigger any error though
<marz_d`ghostman>
darix: it run fine, but when my tests run it invokes an error because the inserted data aren't there. Tried to manually run a select query in `irb` and sqlite3 cli, and the records aren't there
graphene has quit [Remote host closed the connection]
<darix>
your script works here creates 2 tables and then inserts into 1
graphene has joined #ruby
<darix>
and the data is there
<marz_d`ghostman>
really? hmmm
<marz_d`ghostman>
This is weird
<darix>
i commented on your gist
<darix>
also
<darix>
a very glarring lack of openSUSE/SUSE There :P
<marz_d`ghostman>
hahahaha
jcalla has joined #ruby
<darix>
opensuse package for 2.6.0~rc2 submitted
<marz_d`ghostman>
doesn't work on mine though, we have the same exact script. the tables are there but not the data
alan_w has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
kapil____ has joined #ruby
roshanavand has quit [Remote host closed the connection]
roshanavand has joined #ruby
cow[away] has quit [Ping timeout: 268 seconds]
polishdub has joined #ruby
paranoicsan has quit [Quit: paranoicsan]
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
deathwishdave has joined #ruby
Tuor has joined #ruby
Rapture has joined #ruby
gnufied has joined #ruby
rprimus has quit [Ping timeout: 246 seconds]
Tuor has quit [Ping timeout: 244 seconds]
rprimus has joined #ruby
cpruitt has joined #ruby
<marz_d`ghostman>
darix: I'm not sure if it because of the versions, but db.commit semms to have fixed it
<marz_d`ghostman>
db.commit before the inserts
venmx has joined #ruby
<darix>
marz_d`ghostman: for me it was ruby 2.5.3 + ruby2.5-rubygem-sqlite3-1.3.13-1.11.x86_64
nakuku has quit [Remote host closed the connection]
<marz_d`ghostman>
I'm using ruby 2.4 though, and I was wrong, it still isn't working lol
spiette has joined #ruby
Emmanuel_Chanel has quit [Quit: Leaving]
cnsvc_ has quit [Ping timeout: 256 seconds]
Inline has joined #ruby
conta has quit [Ping timeout: 245 seconds]
eb0t has quit [Ping timeout: 244 seconds]
Emmanuel_Chanel has joined #ruby
eb0t has joined #ruby
maryo has joined #ruby
eminencehc has joined #ruby
aufi has quit [Read error: Connection reset by peer]
<marz_d`ghostman>
darix: Tried running in in its own script, and it seems to work. But when I require it inside the spec_helper, it doesn't. Is there something in spec_helper or rspec that is conflicting with it?
elphe has quit [Ping timeout: 250 seconds]
aufi has joined #ruby
elphe has joined #ruby
cow[moo] has joined #ruby
<darix>
maybe they block commits
<cpruitt>
I'm sure this is some kind of pre-caffeine fog, but I'm having an issue with `require`. If I `puts File.expand_path('../../../02_karate_chop/karate_chop.rb', __FILE__)` I'll get /Users/username/Dev/code_kata/ruby/02_karate_chop/karate_chop.rb
<cpruitt>
If I use require instead of puts I get a LoadError but the file path is different: /Users/username/Dev/code_kata/02_karate_chop/karate_chop.rb (note the absence of /ruby/)
<cpruitt>
Am I missing something here?
<jhass>
exact same command to run in both cases?
<cpruitt>
Yes
<cpruitt>
I'm literally just editing the file & changing puts to require
<jhass>
try require_relative instead
<cpruitt>
Even tried assigning the path to a variable & using that for both. Different outputs
<cpruitt>
jhass: Yeah, I can do that, but I'd kinda like to know why it's changing. Maybe rspec is doing something? It's at the top of a spec file
<jhass>
given it's "ruby" that vanishes I wouldn't even rule out require doing something there
<jhass>
anyway, what you're doing there is require_relative's job, let it do its work
<cpruitt>
Oh shoot.... I found the problem. self.moron == true
<jhass>
I'd still urge you to use require_relative ;)
vondruch has quit [Quit: vondruch]
<cpruitt>
I wasn't looking closely enough at the stack trace. Got so caught up on the error being the same that I didn't notice that one error was coming from one file and one from a different file with a nearly identical name.
<cpruitt>
& yes, I've edited to use require_relative. Thanks.
<rubydoc>
did not understand that, parser error @ char position 0
<jhass>
<3
jobewan has joined #ruby
<phaul>
I should make some changes.. I know it's annoying.
neuraload has quit [Quit: This computer has gone to sleep]
akem has quit [Remote host closed the connection]
cnsvc_ has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
mostlybadfly has joined #ruby
masterasia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<marz_d`ghostman>
With sqlite3 gem, why does results_as_hash return {"pre_cmd_result"=>"Failed", 0=>"Failed"} two hashes for one result?
davidw has joined #ruby
conta has joined #ruby
conta1 has joined #ruby
conta has quit [Ping timeout: 246 seconds]
conta1 is now known as conta
cd has joined #ruby
hutch has joined #ruby
Dreamer3 has quit [Quit: Computer has gone to sleep.]
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cnsvc_ has quit [Ping timeout: 256 seconds]
marz_d`ghostman has quit [Quit: Page closed]
blackmesa has joined #ruby
krawchyk has joined #ruby
aufi has quit [Ping timeout: 268 seconds]
yorickpeterse has joined #ruby
cd has quit [Read error: Connection reset by peer]
Fusl has quit [Write error: Connection reset by peer]
code_zombie has joined #ruby
cd has joined #ruby
orbyt_ has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
akaiiro has joined #ruby
\void has joined #ruby
graphene has quit [Remote host closed the connection]
hiroaki has joined #ruby
graphene has joined #ruby
nowhere_man has quit [Ping timeout: 246 seconds]
johnny56 has quit [Ping timeout: 272 seconds]
Fusl has joined #ruby
darkhanb has joined #ruby
chouhoulis has quit [Remote host closed the connection]
uplime has joined #ruby
za1b1tsu has quit [Ping timeout: 250 seconds]
graphene has quit [Remote host closed the connection]
zipace has quit [Ping timeout: 260 seconds]
graphene has joined #ruby
Eiam has joined #ruby
yorickpeterse has quit [Quit: WeeChat 2.3]
<Eiam>
I was recently playing around with using sentinel style values to indicate intent rather than nil/empty and one of the things I found cumbersome was when you use a value like :no_value instead of leaving it nil, that operations like .any? treat :no_value as true, but nil as false
<Eiam>
which makes things get messy real fast
keden has quit [Quit: WeeChat 2.3]
<Eiam>
because then you are having to check for ==true (if your options are true, false or :no_value)
zipace has joined #ruby
<Eiam>
is the safest path forward there to wrap those into a small struct to not expose the bool directly either?
dbz has joined #ruby
dbz_ has joined #ruby
dbz has quit [Ping timeout: 250 seconds]
quipa has joined #ruby
dbz_ has quit [Ping timeout: 245 seconds]
dbz has joined #ruby
roshanavand has quit [Remote host closed the connection]
roshanavand has joined #ruby
nowhere_man has joined #ruby
Dreamer3 has joined #ruby
dbz has quit [Remote host closed the connection]
elphe has quit [Ping timeout: 240 seconds]
InfinityFye has quit [Quit: Leaving]
conta has quit [Quit: conta]
quipa has quit [Read error: Connection reset by peer]
chouhoulis has joined #ruby
johnny56 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
mostlybadfly has quit [Quit: Connection closed for inactivity]
serard has joined #ruby
cnsvc_ has joined #ruby
reber has joined #ruby
maryo has quit [Ping timeout: 240 seconds]
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
Eiam: I'm not seriously suggesting reimplementing Enumerable. I think that pattern is tough to pull off in Ruby, since what is falsey is hardcoded.
serard_ has joined #ruby
orbyt_ has quit [Read error: Connection reset by peer]
<Eiam>
thats what im finding, but I really wanted to not rely on the absence of a value to mean something specific
<Eiam>
the code is just.. awful
<Eiam>
that may be a reflection on its author however
<Eiam>
oh clojure con god
<Eiam>
my old manager became a clojure nut, never shuts up about it now
<Eiam>
=)
r29v has joined #ruby
serard__ has joined #ruby
impermanence has joined #ruby
serard has quit [Ping timeout: 252 seconds]
r29v has quit [Client Quit]
conta has joined #ruby
<Eiam>
watching
serard_ has quit [Ping timeout: 252 seconds]
r29v has joined #ruby
impermanence has quit [Ping timeout: 250 seconds]
WebDawg has quit [Quit: peace]
krawchyk_ has joined #ruby
krawchyk has quit [Ping timeout: 240 seconds]
hiroaki has quit [Ping timeout: 250 seconds]
zapata has quit [Quit: WeeChat 2.3]
conta has quit [Quit: conta]
venmx has quit [Ping timeout: 268 seconds]
hiroaki has joined #ruby
krawchyk_ has quit [Quit: krawchyk_]
hiroaki has quit [Ping timeout: 245 seconds]
graphene has quit [Remote host closed the connection]
hutch has quit [Ping timeout: 268 seconds]
graphene has joined #ruby
krawchyk has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
cow[moo] is now known as cow[away]
hiroaki has joined #ruby
hutch has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
gix has joined #ruby
serard__ has quit [Quit: Leaving]
serard has joined #ruby
phaul has quit [Quit: bye]
<Eiam>
havenwood: if I understand what hes said correctly its basically "Solving this is a language problem and none of them have great solutions here are some things I'm poking at or proposing"
sameerynho has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
lxsameer has quit [Ping timeout: 250 seconds]
masterasia has joined #ruby
dbugger_ has quit [Remote host closed the connection]
serard has quit [Ping timeout: 252 seconds]
<havenwood>
Eiam: My main takeaway was when you change your level of certainty about whether there'll be a value, you shouldn't have to change all the code dealing with that value.
graphene has quit [Remote host closed the connection]
graphene has quit [Remote host closed the connection]
SeepingN has joined #ruby
hutch has quit [Ping timeout: 246 seconds]
graphene has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
orbyt_ has joined #ruby
<havenwood>
Eiam: An aside, but a pattern I've seen for undefined is: undefined = Object.new
<havenwood>
Eiam: (So you don't get a possible symbol collision with :no_value being a value type of thing.)
<Eiam>
Im importing data, I map that data to either I know this value is true, I know this value is false, or I dont know if this value is true or false
graphene has quit [Remote host closed the connection]
cnsvc_ has quit [Ping timeout: 256 seconds]
graphene has joined #ruby
<havenwood>
Eiam: So `nil` is both the placeholder 'no value yet' and also the uncertain 'value maybe this or that'?
venmx has joined #ruby
hiroaki has quit [Ping timeout: 240 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
Renich has quit [Ping timeout: 246 seconds]
hutch has joined #ruby
<Eiam>
well, I don't allow nils, so an empty state is set to :no_value
<Eiam>
its just handling that no_value is fairly annoying in Ruby itself
<Eiam>
a false means "I know the answer, and its false" a true means "I know the answer, and its true" and :no_value means I don't know if this is true or false.
reber has quit [Remote host closed the connection]
themsay has joined #ruby
cnsvc_ has joined #ruby
themsay has quit [Read error: Connection reset by peer]
orbyt_ has quit [Read error: Connection reset by peer]
chouhoulis has quit [Ping timeout: 250 seconds]
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 250 seconds]
tiff has joined #ruby
hutch has quit [Ping timeout: 246 seconds]
hutch has joined #ruby
zapata has quit [Quit: WeeChat 2.3]
venmx has quit [Ping timeout: 272 seconds]
dachi_ has joined #ruby
<dachi_>
Hi
ivanskie has joined #ruby
<dachi_>
I have not new to Ruby, but this time I have to make a wrapper around some enterprise software API. I was asked to design it with some clever and original pattern.
za1b1tsu has quit [Remote host closed the connection]
polishdub has quit [Quit: leaving]
GodFather has quit [Ping timeout: 246 seconds]
cthulchu has quit [Ping timeout: 246 seconds]
go|dfish has quit [Ping timeout: 240 seconds]
za1b1tsu has joined #ruby
cthulchu has joined #ruby
<Eiam>
clever and original pattern for an enterprise API... I dunno something just doesn't feel right with that statement but I cannot quite put my finger on it
<Eiam>
dachi_: implement it all via method_missing. Its not original at all, at least not in Ruby. I'd argue its cleverness
hutch has quit [Ping timeout: 240 seconds]
<Eiam>
havenwood: feels like we talked ourselves into a circle of everyone agrees its not great and here we are
go|dfish has joined #ruby
hutch has joined #ruby
<havenwood>
dachi_: For an api framework, I'd recommend Roda. It's great for intermediary dsls.
<dachi_>
Eiam: thanks. havenwood I'll check that out, great
<dachi_>
SeepingN: thank you too
<Eiam>
lol
<Eiam>
i feel like only one of those people were actually helpful
<havenwood>
dachi_: Is your client going to be used as a gem by multiple apps?
<dachi_>
havenwood: nice thanks
FernandoBasso has joined #ruby
<havenwood>
dachi_: I often use HTTP.rb or Typhoeus, but Faraday can also be nice if your SDK might be used by apps themselves using different HTTP clients.
<havenwood>
Change a setting, swap the underlying client to match your stack.
<dachi_>
I used Faraday for last projects, yea I like it a lot
<havenwood>
dachi_: Ca you do a GraphQL endpoint on the server end? :P
Fernando-Basso has quit [Ping timeout: 252 seconds]
<dachi_>
no, I don't have permission to amend server...
<havenwood>
dachi_: And your SDK is going to be used as a library in apps consuming the server API?
<dachi_>
hm, It's so interesting to read 'pure ruby impelementations' from your spreadsheet. Not for this project, generally, never looked at these carefully
<dachi_>
yes.. It's like .. It's for developers who would like to talk with that huge server easily
<havenwood>
yeah, HTTPClient and Excon are both nice
ellcs has joined #ruby
<havenwood>
dachi_: I think an idiomatic interface that's as simple as it can be is the nicest thing.
<havenwood>
dachi_: Really nice to add value with tuned throttling to match the server or automatic retries and exponential backoff.
<dachi_>
havenwood: yes probably. I'll just have to write code very carefully and that's it in theory, i guess
druonysus has joined #ruby
AJA4350 has quit [Remote host closed the connection]
<havenwood>
dachi_: If the API isn't nice, adding proper errors, resolving inconsistent naming and such at the SDK level can be a big win.
<havenwood>
dachi_: PS - I'd call what you're writing an SDK, just because libraries that wrap APIs get called SDKs these days for whatever reason.
tiff has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dachi_>
agree about errors and naming
<dachi_>
yea, I've some old repo tagged with ruby-sdk, just checked :|
<dachi_>
just took a glance, that's not very well written :p will need to work harder