<Radar>
You're right that it's broken in sequel, but only on the latest gem release. Master contains a fix for this problem already.
Devalo has quit [Ping timeout: 240 seconds]
iamyask has quit [Quit: Connection closed for inactivity]
<Radar>
I include my steps to reproduce the issue, and a link to the commit which fixes it.
hutch34 has joined #ruby
jphase has joined #ruby
goyox86 has quit [Quit: goyox86]
apeiros has quit [Ping timeout: 260 seconds]
alfiemax_ has quit [Remote host closed the connection]
jphase has quit [Ping timeout: 240 seconds]
<darix>
thank you for the deeper look!
neo95 has quit [Quit: Leaving]
charliesome_ has joined #ruby
enterprisey has joined #ruby
charliesome has quit [Ping timeout: 240 seconds]
jphase has joined #ruby
ElDoggo has joined #ruby
xall has joined #ruby
ElDoggo_ has joined #ruby
AndBobsYourUncle has joined #ruby
jdawgaz has joined #ruby
<darix>
Radar: the good news is i can link the sequel fix to seed-fu as guideline how to fix it :D
ElDoggo has quit [Ping timeout: 240 seconds]
hutch34 has quit [Ping timeout: 240 seconds]
Freshnuts has quit [Ping timeout: 240 seconds]
ElDoggo has joined #ruby
nofxx has joined #ruby
ElDoggo_ has quit [Ping timeout: 240 seconds]
ElDoggo_ has joined #ruby
AndBobsYourUncle has quit [Ping timeout: 252 seconds]
h-michael has quit [Remote host closed the connection]
GodFather has quit [Ping timeout: 258 seconds]
apeiros has joined #ruby
ElDoggo__ has joined #ruby
jphase has quit [Ping timeout: 248 seconds]
ElDoggo has quit [Ping timeout: 240 seconds]
ElDoggo_ has quit [Ping timeout: 240 seconds]
ElDoggo has joined #ruby
solocshaw has quit [Ping timeout: 246 seconds]
ElDoggo__ has quit [Ping timeout: 248 seconds]
apeiros has quit [Ping timeout: 248 seconds]
ElDoggo_ has joined #ruby
ElDoggo__ has joined #ruby
ElDoggo has quit [Ping timeout: 240 seconds]
ElDoggo_ has quit [Ping timeout: 240 seconds]
charliesome has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
ElDoggo__ has quit [Ping timeout: 248 seconds]
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charliesome_ has quit [Ping timeout: 248 seconds]
jdawgaz has joined #ruby
cdg has joined #ruby
charliesome has quit [Client Quit]
jphase has joined #ruby
ur5us has quit [Remote host closed the connection]
nopolitica has joined #ruby
ZombiemirPutin is now known as davic
nofxx has quit [Quit: Leaving]
sucks_ has joined #ruby
nofxx has joined #ruby
jphase has quit [Ping timeout: 246 seconds]
guacamole has joined #ruby
sucks has quit [Ping timeout: 240 seconds]
jphase has joined #ruby
cagomez has joined #ruby
jphase has quit [Ping timeout: 240 seconds]
alex`` has joined #ruby
ur5us has joined #ruby
gizmore has joined #ruby
cadillac_ has quit [Quit: I quit]
cadillac_ has joined #ruby
gizmore|2 has quit [Ping timeout: 248 seconds]
troys_ is now known as troys
jphase has joined #ruby
guacamole has quit [Read error: Connection reset by peer]
guacamole has joined #ruby
DLSteve has quit [Ping timeout: 240 seconds]
jphase has quit [Ping timeout: 246 seconds]
jphase has joined #ruby
RougeR has quit [Quit: Leaving]
hutch34 has joined #ruby
sorg has joined #ruby
<sorg>
Hi, I'm using Regex for a project. Every time I use mystring.match() should I pass in Regexp.new(/my regex/) or is mystring.match(/mystring/) enough?
<Radar>
sorg: the latter is fine
<sorg>
Radar: Great, thanks!
sorg has quit [Client Quit]
alan_w has joined #ruby
alan_w has quit [Client Quit]
orbyt_ has joined #ruby
uZiel has joined #ruby
xall_ has joined #ruby
alfiemax_ has joined #ruby
arescorpio has quit [Quit: Leaving.]
<nofxx>
Radar, ain't =~ /more rubesque?/
xall has quit [Read error: Connection reset by peer]
<Radar>
nofxx: who am I to judge?
jphase has quit [Ping timeout: 255 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xall_ has quit [Client Quit]
cagomez has quit [Remote host closed the connection]
apeiros has joined #ruby
kies has quit [Ping timeout: 240 seconds]
<darix>
nofxx: tbh i prefer .match nowadays as i get a match object. and named match groups are so much more fun
<Radar>
>> "quick brown fox jumped over"[/brown/, 0]
<dminuoso>
bob_f: so if foo responds to to_str, that's what will be used.
<dminuoso>
Or no.
<bob_f>
dminuoso: Okay, that makes sense.
<bob_f>
Oh. :(
ek926m has quit [Max SendQ exceeded]
<dminuoso>
bob_f: I was looking at String#===
<dminuoso>
bob_f: for String === it's Class#=== that will be used.
ek926m has joined #ruby
<dminuoso>
Fooled me well there.
alfiemax has quit [Ping timeout: 246 seconds]
<bob_f>
dminuoso: Aha, interesting. I am trying to do something awful, and this was a hurdle.
<dminuoso>
bob_f: Or Module#=== rather
morfin has joined #ruby
<morfin>
hello
<morfin>
rubygems rely on tags when downloading from git?
ek926m has quit [Max SendQ exceeded]
ek926m has joined #ruby
ek926m has quit [Max SendQ exceeded]
<morfin>
as example i have gem which i added like gem 'mygem', '~1.0.0' would it rely on tags or what?
GreatMazi has joined #ruby
ek926m has joined #ruby
ek926m has quit [Remote host closed the connection]
ek926m has joined #ruby
<bob_f>
dminuoso: Yeah, so I made the same mistake as you, but unfortunately looking at Module#=== it doesn't look like there's anything I can override.
<bob_f>
dminuoso: Unless rb_ob_js_kind_of(arg, mod) calls a method on the RHS object ?
<bob_f>
Sorry for the typo - working on two machines at the moment.
<bob_f>
C source for `rb_obj_is_kind_of` suggests it just looks directly at the object's class/ancestors, rather than calling any Ruby instance method.
Psybur has joined #ruby
anisha has quit [Ping timeout: 240 seconds]
<bob_f>
dminuoso: Ah, don't worry about it - I just changed the `if String === value` line elsewhere in the lib. No need to hack this.
<bob_f>
Thanks for the pointer though.
<morfin>
well, you can just get ancestors and checn include? i guess
<morfin>
it works even with included classes
<bob_f>
morfin: The class doesn't inherit from String. It used to, but I think this is a mistake so I'm changing that.
<morfin>
bob_f look at this
<elomatreb>
morfin: gems are downloaded and published according to the versions on rubygems.org, unless you use the bundler git endpoints git tags play no role
<morfin>
i use git endpoint and wondering how versions are handled for such gems
darkness has quit [Remote host closed the connection]
<dminuoso>
It's reasonable to use tags on commits that have been released on rubygems.org though
<morfin>
>> module Foo end; class Bar include Foo; end; Bar.ancestors
<morfin>
bob_f, see - Bar do not inherit from Foo but still has Foo in ancestors
<elomatreb>
If you use git endpoints I think it will by default grab the latest master commit, unless you tell it to get a tag or some other branch
<bob_f>
morfin: Sure, but you can't `include String` on a class so I'm not sure how this helps ?
nadir has joined #ruby
<bob_f>
morfin: The solution is to just fix the single point where it checks if the type is a String, and add the actual type of the object instead, rather than relying on it having String as an ancestor.
mim1k has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<KenSentMe>
Hello, i’m trying to write a script where a sound is played when a certain key is pressed. How can i let the script do something when for example pressing the ‘a’ key?
<elomatreb>
tbf how often you actually want to enumerate all values in a range vs. how often you want to double a range, I think the current behavior is fine
<havenwood>
mm
<dminuoso>
elomatreb: Is it too much to ask for .to_a if you want an array?
charliesome_ has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
alfiemax has joined #ruby
aufi has quit [Quit: Leaving]
<elomatreb>
Maybe if it was designed to be like that from the start, but I don't think the effort of changing it now would be justified by that kind-of-nice behavior
<dminuoso>
Now if only you could invoke lvar callables like: doubleF [1,2,3]
kahra has joined #ruby
<dminuoso>
Then Ruby would be awesomesauce.
<dminuoso>
However! set_trace_func to the rescue!
alfiemax has quit [Ping timeout: 246 seconds]
kahra has quit [Client Quit]
polishdub has joined #ruby
pushergene has quit [Quit: Page closed]
pb122 has quit [Read error: Connection reset by peer]
cschneid_ has joined #ruby
<havenwood>
dminuoso: I guess the syntactical nicety is just a method definition away: define_method :doubler, doubleF
guacamole has joined #ruby
<texasmynsted>
hmm. Why does "ruby-install --latest ruby" need my root password?
<havenwood>
texasmynsted: do you not own your ~/.rubies/ directory?
<texasmynsted>
This is a brew thing, it should not need root right?
bruno- has joined #ruby
<havenwood>
texasmynsted: if you installed ruby-install with `sudo` it'll install to a system directory where you'll need root to install Rubies.
<havenwood>
err
<texasmynsted>
no I own it
<dminuoso>
havenwood: Wow that's interesting. I mean I definitely dont want to tag my functions with define_method, it really diminishes the beauty of tacit programming.
<dminuoso>
But TIL. Wasnt aware you could define_method against callables.
<texasmynsted>
no just ruby-install
ek926m has joined #ruby
iamarun has joined #ruby
<havenwood>
texasmynsted: It's odd, because the default location is in your home, so...
<texasmynsted>
hmm
<havenwood>
i retract what i said about root, i need coffee
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
texasmynsted: If you don't prefix your `ruby-install` command with `sudo` and don't otherwise have `UID == 0` then src/ and .rubies/ should be in $HOME.
<havenwood>
texasmynsted: Check you can create a directory in ~/.rubies/ and ~/src/ as is?
<texasmynsted>
I just did a ctrl-z and then whoami, and I am me not root
<ruby[bot]>
havenwood: # => [1, [:trace, 1], [:putobject, :itself], [:opt_send_without_block, {:mid=>:to_proc, :flag=>16, :orig_ ...check link for more (https://eval.in/891733)
<havenwood>
dminuoso: nice
guacamole has quit [Client Quit]
govg has joined #ruby
guacamole has joined #ruby
troys has joined #ruby
lovemercy124 has joined #ruby
xrlabs has quit [Quit: Connection closed for inactivity]
lovemercy124 has quit [Client Quit]
chouhoulis has quit [Remote host closed the connection]
conta has quit [Ping timeout: 248 seconds]
cadillac_ has quit [Ping timeout: 248 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has joined #ruby
ramfjord has joined #ruby
polishdub has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
solocshaw has joined #ruby
aufi has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
cadillac_ has joined #ruby
vipaca has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
michael1 has quit [Ping timeout: 260 seconds]
<texasmynsted>
Ok, I have a Gemfile with many gems. How do I find out what the latest stable version is, say of rake? I have 0.9 listed in Gemfile. Maybe it does not matter?
kies has joined #ruby
<texasmynsted>
if I do "gem list" it will show me the current versions of locally installed gems.
Xiti has joined #ruby
vipaca has joined #ruby
<elomatreb>
texasmynsted: `bundle outdated`
<texasmynsted>
oh nice
<texasmynsted>
that seems better than gem list -r |grep '^rake '
thinkpad has quit [Ping timeout: 248 seconds]
ramfjord has joined #ruby
<texasmynsted>
if I bundle update, will that update to the latest "compatible" versions?
raul782 has joined #ruby
<texasmynsted>
or just try to update everything to the latest stable version?
mim1k has quit [Ping timeout: 248 seconds]
yebo_ has joined #ruby
solocshaw has quit [Ping timeout: 246 seconds]
michael1 has joined #ruby
cabotto has joined #ruby
* texasmynsted
shrug. Just going to try and see what happens
Xiti has quit [Quit: Xiti]
Kestrel-029 has quit [Ping timeout: 252 seconds]
xMopxShell has joined #ruby
dextrey has joined #ruby
<texasmynsted>
oh I see. It does not alter the Gemfile
ramfjord has quit [Ping timeout: 248 seconds]
bronson has quit [Ping timeout: 248 seconds]
ramfjord has joined #ruby
Nicmavr has joined #ruby
Nicmavr has quit [Changing host]
Nicmavr has joined #ruby
mim1k has joined #ruby
lacour has joined #ruby
ltp has quit [Ping timeout: 240 seconds]
<elomatreb>
texasmynsted: Sorry. bundle update will install the newest versions matching the constraints specified in the gemfile, and update the Gemfile.lock with the exact versions
mostlybadfly has joined #ruby
ltp has joined #ruby
<texasmynsted>
I am just going to try to update the Gemfile to all latest and see what happens.
anisha has quit [Read error: Connection reset by peer]
<texasmynsted>
This seems wrong but.
* texasmynsted
shrug
orbyt_ has joined #ruby
anisha has joined #ruby
guacamole has quit [Quit: My face has gone to sleep. ZZZzzz…]
<elomatreb>
If the constrains in the Gemfile were specified correctly, you shouldn't need to do much. E.g. "~> 11.0" like with rake means "11.0.0 or later"
anisha has quit [Client Quit]
cadillac_ has quit [Read error: Connection reset by peer]
<texasmynsted>
I should likely replace octopress but do not want to take the time at the moment, for something working
guacamole has joined #ruby
TomyWork has quit [Remote host closed the connection]
<havenwood>
yebo_: Did you check that the mailer files exist like suggested earlier? That's really a better #RubyOnRails question as folk have pointed out. That channel should be more busy at this hour, so if you hang around you might get an answer.
<texasmynsted>
sigh " You have already activated rake 12.0.0, but your Gemfile requires rake 12.2.1."
<havenwood>
yebo_: There's also a Ruby on Rails Slack channel that's pretty busy.
<texasmynsted>
I thought bundle install would install the version from the Gemfile
<havenwood>
texasmynsted: It will install the version from the Gemfile.lock, if one exists.
nowhere_man has joined #ruby
<texasmynsted>
oh dear
<havenwood>
texasmynsted: bundle exec rake
Sembei has joined #ruby
<texasmynsted>
so basically use the rake as defined in the Gemfile rather than whatever is installed for my local system?
<havenwood>
texasmynsted: yes, by prefixing `bundle exec` to the command, it'll pin to the exact version specified in the Gemfile.lock.
Pisuke has quit [Ping timeout: 246 seconds]
eckhardt_ has joined #ruby
mikejw has quit [Quit: Leaving]
charliesome_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
eckhardt has quit [Ping timeout: 258 seconds]
cabotto has quit [Ping timeout: 264 seconds]
ruby874 has joined #ruby
alan_w has joined #ruby
<alan_w>
lose
goyox86 has joined #ruby
<baweaver>
win
alan_w has left #ruby [#ruby]
<baweaver>
aha, I won
cagomez has quit [Remote host closed the connection]
alan_w has joined #ruby
phaul has joined #ruby
troys is now known as troys_
cagomez has joined #ruby
ruby874 has quit [Client Quit]
<texasmynsted>
wow
apeiros has quit [Remote host closed the connection]
jamesaxl has quit [Read error: Connection reset by peer]
<texasmynsted>
Hmm "An error occurred while installing yajl-ruby (1.1.0)"
jamesaxl has joined #ruby
<texasmynsted>
My Gemfile wants Ruby 2.0.0, I have the latest installed. I seem to be unable to install 2.0.0. If I update the Gemfile to use 2.4.2 then I get this error on bundle install.
Serpent7776 has quit [Quit: Leaving]
<lobloblobster>
texasmynsted: Does it have native extensions?
vipaca has joined #ruby
sucks_ has quit [Read error: Connection reset by peer]
<texasmynsted>
no idea
<texasmynsted>
Maybe I just need a old 2.0.x version of Ruby for it.
<texasmynsted>
I keep trying ruby-install ruby 2.0.0, or 2.0, or 2.0-stable, etc.
<texasmynsted>
ok, now I see what it meant by auto. Ok this is very nice
phaul has quit [Quit: WeeChat 1.9.1]
oleo2 has joined #ruby
mim1k has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eblip has joined #ruby
def_jam has joined #ruby
orbyt_ has joined #ruby
alnewkirk has joined #ruby
<texasmynsted>
oh I guess chruby does not persist unless you create the .ruby-version file
eb0t_ has quit [Ping timeout: 240 seconds]
<havenwood>
texasmynsted: no, it doesn't persist env vars between shell sessions
<havenwood>
texasmynsted: you can create a .ruby-version file in / or ~ to set a default
eb0t has quit [Ping timeout: 264 seconds]
<texasmynsted>
this is perfect
kies has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #ruby
<havenwood>
we've discussed adding more functionality for setting a default, but for now it's just .ruby-version
Dimik has joined #ruby
funburn has quit [Remote host closed the connection]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
troys is now known as troys_
alfiemax has joined #ruby
voice_ftp has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kinduff has joined #ruby
<kinduff>
good morning
alnewkirk has quit [Ping timeout: 248 seconds]
<havenwood>
g'mornin'
voiceftp has quit [Ping timeout: 240 seconds]
kinduff has quit [Quit: gg]
kinduff has joined #ruby
goyox86 has quit [Ping timeout: 258 seconds]
apeiros has quit [Ping timeout: 260 seconds]
kinduff has quit [Client Quit]
kinduff has joined #ruby
alnewkirk has joined #ruby
apeiros_ has joined #ruby
funburn has joined #ruby
ramfjord has joined #ruby
alnewkirk has quit [Ping timeout: 248 seconds]
cagomez has quit [Remote host closed the connection]
apeiros_ is now known as apeiros
ElDoggo has quit [Remote host closed the connection]
cagomez has joined #ruby
<jolamb>
ok, circular dependency problem. I have files lib/a.rb and lib/b.rb. b.rb depends on a.rb - `requires 'a'`. I have test/test_a.rb and test/test_b.rb. test_a.rb has `require a`, test_b.rb has `require b`. When I run "rake test" it warns about circular dependencies, because - I think - a.rb gets required twice
<jolamb>
Is this happening because I'm doing something wrong when I require a from b, or is this warning something I should suppress/ignore?
<kinduff>
jolamb: indeed, you're falling into a circular pattern there, either you require at higher level (b.rb -> a.rb), or call b.rb at test_a.rb
mikecmpbll has joined #ruby
<jolamb>
kinduff: I don't get what you mean by "require at higher level (b.rb -> a.rb)" - b.rb already requires a.rb
aufi has quit [Ping timeout: 240 seconds]
darkmorph has joined #ruby
GreatMazi1 has joined #ruby
<kinduff>
jolamb: by higher level I mean, maybe you got c.rb that requires a&b.rb, and that's what you call for test_a.rb and test_b.rb, or for your script, and you leave your tests with the corresponding require.
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has quit [Ping timeout: 248 seconds]
PaulCape_ has quit [Read error: Connection reset by peer]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<kinduff>
something like that, I'm just waking up so I'm not sure if that works for your case
gGREATmAZI has quit [Ping timeout: 246 seconds]
jrafanie has joined #ruby
PaulCapestany has joined #ruby
jdawgaz has joined #ruby
guacamole has joined #ruby
<jolamb>
kinduff: I'm pretty sure that's what I've got more or less. Lemme poke at this a bit more
uZiel has quit [Ping timeout: 248 seconds]
alnewkirk has joined #ruby
imode has joined #ruby
PaulCapestany has quit [Quit: .]
arup_r has joined #ruby
<arup_r>
I am trying to replace the playlistId with some interger. Input string: "playlistNotFound: The playlist identified with the requests <code>playlistId</code> parameter cannot be found." .. Output I want: "playlistNotFound: The playlist identified with the requests <code>123</code> parameter cannot be found." .. I was trying: sub(/<code>(playlistId)</code>/, '1') , But it is close, not correct. :) Any help
Devalo has joined #ruby
<apeiros>
arup_r: the / needs escaping
Devalo has quit [Remote host closed the connection]
<apeiros>
also you'll replace the <code></code> too
<jolamb>
kinduff: hrm, looks like it's actually a circular dependency in the oauth gemn
ElDoggo has joined #ruby
dextrey has joined #ruby
<arup_r>
apeiros: yeah I tried s.sub(/<code>(playlistId)<\/code>/, '1') . but it is replacing all as you said. But I want to replace just * playlistId*
jaruga has quit [Quit: jaruga]
<apeiros>
arup_r: the rest is static, shouldn't be that hard to add it to the replacement part
<kinduff>
apeiros: a = "Hello %{where}"; a % { :where => "world!" }
<kinduff>
apeiros: => "Hello world!"
<kinduff>
jolamb: oh, comes from a gem then?
<apeiros>
kinduff: you certainly meant arup_r
<kinduff>
oops
<arup_r>
kinduff: input string is not under my control :)
<jolamb>
kinduff: looks that way. Any way I can tell ruby to skip warnings on external deps?
sameerynho has joined #ruby
Devalo has joined #ruby
<kinduff>
jolamb: can you provided more context on how you're using the gem?
mim1k has quit [Ping timeout: 240 seconds]
<kinduff>
arup_r: why not just sub("playlistId", "123")
<arup_r>
apeiros: you meant like this rigt s.sub(/<code>(playlistId)<\/code>/, '<code>1</code>') ? It works. just confirming
<jolamb>
I've got a dependency on ruby-trello. It depends on oauth. oauth.rb requires oauth/client/helper, which requires oauth/consumer, which requires oauth/client/net_http, which requires oauth/client/helper
<apeiros>
arup_r: yes
<arup_r>
hm. thanks apeiros
ElDoggo has quit []
<apeiros>
kinduff: depending on the input string, that's more volatile
<jolamb>
kinduff: ^^ there's the context
<apeiros>
+potentially
funburn has quit [Quit: funburn]
darkmorph has quit [Ping timeout: 252 seconds]
<apeiros>
does anybody happen to use the 2016 or 2017 mbp with 2x 5k screens? if so, does using both screens spin up the fans?
Devalo has quit [Ping timeout: 260 seconds]
BTRE has quit [Ping timeout: 260 seconds]
conta1 has joined #ruby
arup_r has quit []
dextrey has quit [Ping timeout: 252 seconds]
oleo2 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
conta1 has quit [Ping timeout: 248 seconds]
oleo2 has joined #ruby
BTRE has joined #ruby
nowhere_man has quit [Remote host closed the connection]
audy- has quit [Quit: bye]
jphase has quit [Remote host closed the connection]
nowhere_man has joined #ruby
jphase has joined #ruby
alnewkirk has quit [Ping timeout: 240 seconds]
Devalo has joined #ruby
jphase has quit [Remote host closed the connection]
kies has joined #ruby
jphase has joined #ruby
beerich has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
funburn has joined #ruby
<beerich>
Anybody have experience with server-side validations?
<apeiros>
beerich: you'll usually have a much better chance at an answer if you ask your actual question instead of metaquestions like this
Devalo has quit [Ping timeout: 240 seconds]
<beerich>
Is there a common approach to validations with regards to assertions or nomenclature choices in order to standardize structure?
vipaca has joined #ruby
funburn has quit [Client Quit]
<apeiros>
what kind of server are we talking about?
funburn has joined #ruby
<beerich>
a ruby web server
<apeiros>
using a framework?
memo1 has joined #ruby
<beerich>
Sinatra
<beerich>
I'm writing my own framework
funburn has quit [Client Quit]
<apeiros>
not familiar with sinatra, but that'd be my starting point
<beerich>
I'm writing assertions
<beerich>
I'm not relying on other frameworks nor validations. I'm writing my own validations. This is not a framework question.
<beerich>
sorry, writing validations
<beerich>
this is a ruby question, not framework
<apeiros>
in that case - you are defining the structure and standardization
<beerich>
yes which is why I'm asking how it's best approached. When I use a method named "validate_referrer", if it returns false, is it invalidated?
<beerich>
Are the set of validations assumed false then approved individually?
<apeiros>
IMO using prefixes is a code smell
<beerich>
code smell?
Azure has quit [Ping timeout: 240 seconds]
<apeiros>
early indicator of something probably being done wrong
<beerich>
why is that?
<apeiros>
why do you have the prefix?
<beerich>
because I'm trying to validate the referrer
<beerich>
hence validate_referrer
<apeiros>
ok. will you have other validate_* methods on the same object?
<beerich>
no
<beerich>
that too would obviously be called validate_referrer
<beerich>
why are you focussing on the method name?
<beerich>
I don't repeat method names
<beerich>
that's obviously a problem
dionysus69 has quit [Ping timeout: 248 seconds]
Azure has joined #ruby
<apeiros>
I don't focus on the method name. I was answering your question
<beerich>
I'm referring to the structure of methods with regards to boolean assumption pre-test. Another question is on the "validate" in the method name, as it suggests if it's returned as true, it is validated.
<apeiros>
I fail to see how other validate_* methods could be called validate_referrer as well, as there can only be one method of a given name. but ok. lets look at it from another angle.
<beerich>
Yes that's my point. What would you call a method that tests its validity?
jrafanie_ has joined #ruby
<apeiros>
depends. what do you want out of it? if it's just to know whether it's valid, I'd call it "valid?"
<apeiros>
if you want to know what's wrong with it, I'd call it "errors"
<beerich>
ok but you write a whole class based on a referrer?
<beerich>
I don't
<apeiros>
I don't know. You gave pretty little context.
<apeiros>
but in general, I'd write a validation class, yes.
<beerich>
it's just that. It's validity of the referrer, to see if it's expected. "errors" would be a whole bunch of tests, which shouldn't be one method.
<beerich>
validations don't have to be in their own class
<apeiros>
and something to validate a referrer would either be a subclass of a generic validation class, or be composed of it
jrafanie_ has quit [Client Quit]
<beerich>
validations can be methods in the class of the object
jrafanie has quit [Ping timeout: 258 seconds]
vipaca has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<beerich>
completely internal
GreatMazi1 has quit [Ping timeout: 252 seconds]
<apeiros>
beerich: either you have questions on how others do it, or you know already how you want to do it
<apeiros>
what is it now?
<beerich>
I have a way of doing it, but I'm asking if there's an accepted approach on the nomenclature
<apeiros>
no
<beerich>
that's what I was asking
<apeiros>
as said, or at least implicated before, that's framework level stuff.
<apeiros>
go look around at how different frameworks do it
<beerich>
there are no validations in Sinatra
<beerich>
I don't rely on frameworks
<apeiros>
*sob*
<apeiros>
no, but you ask for "accepted approaches"
jrafanie has joined #ruby
<apeiros>
if there is one, don't you think it's accepted *because other frameworks* use it?
<beerich>
ok but that doesn't mean the answer is "move to Rails"
<apeiros>
otherwise, what's the meaning of "accepted" at all?
mim1k has joined #ruby
<apeiros>
did I say that?
<beerich>
a generalized approach
ledestin has joined #ruby
<apeiros>
again, if there is a generalized approach, what do you think where it'd materialize? where would it be used?
<beerich>
the meaning of accepted means that people often agree on an approach to their own validations, not just looking at frameworks
<beerich>
it would be used in those objects written by ruby developers
<beerich>
not simply referring to frameworks
quobo has quit [Quit: Connection closed for inactivity]
<apeiros>
ok, I have no idea what you're asking then.
neo95 has joined #ruby
<beerich>
nobody writes validations?
<apeiros>
it makes no sense to me if you phrase it like that.
<apeiros>
you have a weird way of interpreting words.
workmad3 has quit [Ping timeout: 260 seconds]
<beerich>
I'm in a ruby group asking about ruby
<beerich>
not frameworks
<beerich>
I can only think people write their own validations
<apeiros>
I don't think I can help you.
<beerich>
ok
<beerich>
but thank you
<bougyman>
validations of what?
jrafanie has quit [Client Quit]
<beerich>
objects
<beerich>
fields in forms
<beerich>
anything
<beerich>
that's in the scope of the expected object
<bougyman>
Ah.
<matthewd>
... conditionals?
<bougyman>
There are a few ways i've seen.
<bougyman>
Contracts, Design By Contract, is one I liked.
<havenwood>
beerich: If you haven't already, I'd recommend taking a look at Roda and dry-validations.
<beerich>
I'm just thinking there is a structured approach to validations...from a security point of view.
<beerich>
and other angles
<havenwood>
beerich: When you say "validations," what do you mean?
<beerich>
anything coming into a system through a form, or at any point, simply testing the object for sufficient properties
<beerich>
at any point, asking if the object is complete enough for moving on
<havenwood>
beerich: Are you talking about JS validations? Model validations? Database validations? All of them?
alfiemax has quit [Remote host closed the connection]
<beerich>
no
kapil___ has quit [Quit: Connection closed for inactivity]
<beerich>
server side
<beerich>
100% objects
<beerich>
no database, no client...all model
alfiemax has joined #ruby
biberu has quit []
<beerich>
example: A user's firstname isn't "44"
jrafanie has joined #ruby
<matthewd>
beerich: There is not a generally-agreed-upon approach to implementing this from first principles, because the generally-agreed-upon approach is to use existing frameworks (e.g., rails, dry) to do it.
orbyt_ has joined #ruby
<beerich>
validate_firstname, is it automatically assumed as false, tested, then set true? Or the other way around? Is the return of "validity" expected to be true by convention if it's validated?
<beerich>
Ya I tend to write my own
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewd>
Do what you like. But if you explicitly exclude anything frequently-used enough to have been extracted to a library, you're unlikely to learn of a "common approach".
<beerich>
ok that's what I was pretty much looking for. Thanks
<matthewd>
I'm not even sure how to answer your above questions anyway, tbh
<beerich>
I'm constantly trying to sniff out discussed common practices
<matthewd>
"automatically assumed as false, tested, then set true" -- huh? Something is either true or false, or it's not evaluated.
guacamole has joined #ruby
<beerich>
ok but booleans start out as either true or false. There is no nil in boolean.
alfiemax has quit [Ping timeout: 258 seconds]
<beerich>
so you have to assume one and prove otherwise
mim1k has quit [Ping timeout: 240 seconds]
mynameisdebian has joined #ruby
ta has quit [Remote host closed the connection]
<beerich>
Anyway, found what I'm looking for. thanks everyone.
michael2 has joined #ruby
vipaca has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Immune has quit [Ping timeout: 246 seconds]
<mynameisdebian>
Is there a way to quickly create a set of variable with specific names from an array? Something like, myArr.convertToVars("var1", "var2", "varD")
jenrzzz has joined #ruby
<beerich>
your own method
<mynameisdebian>
In other words, if I had [1,2,3] and I used that syntax, it would be equivalent to var1=1 and var2=2 and varD=3
vipaca has joined #ruby
<mynameisdebian>
I only have to do it once and it seems like there would probably be a method for it
<beerich>
nothing already written. Write your own method
<beerich>
nothing like .to_vars
mson has quit [Quit: Connection closed for inactivity]
<mynameisdebian>
If I have an array of values and an array of names, is there a way to do <name>=<value> ?
cagomez has joined #ruby
michael1 has quit [Ping timeout: 240 seconds]
<beerich>
a method. Iterate through each and provide the assignment
<mynameisdebian>
how do I turn the <name> string into a variable?
<apeiros>
mynameisdebian: take a look at Enumerable#zip and #map
<havenwood>
mynameisdebian: We don't really set local variables dynamically like that.
<apeiros>
oh oy, just read the beginning of the question
<apeiros>
don't. don't use variablenames as a hash. use a hash.
<havenwood>
mynameisdebian: If you'd like to play with it in irb, just for fun, try: target_binding = binding; my_array = %w[var_oatmeal var_porridge var_gruel]; my_array.each { |var| target_binding.local_variable_set var, var }; target_binding.irb
kinduff has quit [Quit: gg]
quobo has joined #ruby
<havenwood>
mynameisdebian: then you can: var_porridge #=> "var_porridge"
<apeiros>
havenwood: you should mention that you can't define new variables in a binding
<matthewd>
apeiros: I think you're reading too much into the fact the guessed pseudocode used strings
tomphp has joined #ruby
cdg has joined #ruby
<apeiros>
20:57 mynameisdebian: In other words, if I had [1,2,3] and I used that syntax, it would be equivalent to var1=1 and var2=2 and varD=3
<apeiros>
matthewd: ^
<apeiros>
I don't think so?
<havenwood>
mynameisdebian: TL;DR: don't dynamically set local variables
<mynameisdebian>
damn that sounds complicated
<matthewd>
apeiros: Isn't that a totally reasonable description of `a, b = ary` ?
<apeiros>
matthewd: could be, but `myArr.convertToVars("var1", "var2", "varD")` makes me think otherwise. but if splat answers their question - great :)
<matthewd>
mynameisdebian: Does my answer solve your problem? If not, we probably need more information.
hahuang65 has quit [Read error: Connection reset by peer]
<mynameisdebian>
I had a bunch of variables that I put into an array and output to YAML. I'm reading it back and realizing I want the original variable names. It's easy for me to create an array with the names of the variables as strings, and another with the data variables. Is there a way to take the variable names from the first array and create variables with those names?
<mynameisdebian>
matthewd, I'm sorry, let me read again
<havenwood>
mynameisdebian: Try using hash keys instead of variables to point at values.
<mynameisdebian>
that would have been pretty smart
hahuang65 has joined #ruby
sammi` has quit [Quit: Lost terminal]
Megamos has joined #ruby
<mynameisdebian>
matthewd you're awesome!
<mynameisdebian>
as always
<mynameisdebian>
super cool bro
<mynameisdebian>
thanks everyone else as well
ryzokuken has joined #ruby
ycyclist has joined #ruby
nopolitica has joined #ruby
sagax has quit [Ping timeout: 248 seconds]
alfiemax has joined #ruby
Rapture has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nopolitica has quit [Ping timeout: 246 seconds]
shinnya has joined #ruby
oleo2 has quit [Remote host closed the connection]
BTRE has quit [Ping timeout: 240 seconds]
solocshaw1 has joined #ruby
solocshaw has quit [Read error: Connection reset by peer]
solocshaw1 is now known as solocshaw
BTRE has joined #ruby
oleo2 has joined #ruby
solocshaw has quit [Client Quit]
oleo2 has quit [Remote host closed the connection]
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rapture has joined #ruby
Rapture has quit [Client Quit]
oleo2 has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Immune has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has joined #ruby
safetypin has joined #ruby
memo1 has quit [Ping timeout: 260 seconds]
slima has left #ruby [#ruby]
tomphp has quit [Client Quit]
tomphp has joined #ruby
ta has joined #ruby
neo95 has quit [Quit: Leaving]
Immune has quit [Ping timeout: 248 seconds]
Psybur has quit [Ping timeout: 240 seconds]
ta has quit [Remote host closed the connection]
ta has joined #ruby
dextrey has joined #ruby
synthroi_ has quit []
madhatter has quit [Remote host closed the connection]
<cahoots>
hi, when i use the Hash#to_json and JSON#pretty_generate methods, it gives me fat arrows instead of colons in the hashes. what might be the issue?
<Radar>
cahoots: Do you have an example?
<baweaver>
>> {a: 1, 'b' => 2}.to_json
gauravgoyal has joined #ruby
<ruby[bot]>
baweaver: # => undefined method `to_json' for {:a=>1, "b"=>2}:Hash ...check link for more (https://eval.in/892001)
<havenwood>
"You have to understand what NaN is, before playing with it." ~Matz
jphase has quit [Ping timeout: 260 seconds]
cagomez has joined #ruby
cahoots has quit [Ping timeout: 248 seconds]
Technodrome has joined #ruby
troulouliou_div2 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cahoots has joined #ruby
cagomez has quit [Ping timeout: 260 seconds]
jphase has joined #ruby
nopolitica has joined #ruby
jdawgaz has joined #ruby
<c-c>
Ideas on how to get the console width and height for stdin?
<Radar>
c-c: can you explain a little about why you'd want to do that?
<c-c>
I want to render my own view 30 fps in the console
jphase has quit [Ping timeout: 252 seconds]
alan_w has quit [Ping timeout: 255 seconds]
geizp has joined #ruby
jphase has joined #ruby
nopolitica has quit [Ping timeout: 240 seconds]
<geizp>
have a question about the minitest gem... when it outputs, it runs each test, lists "S" after each one right now, i'm just starting. i get that means "skipped." i also have one that has an asterisk, but have no idea what that means or where to find it in the documentation