« Back to channel list

#ruby - 20 September 2018

« Back 1 day
[00:01:14] chichouw: has joined #ruby
[00:08:37] marz_d`ghostman: I'm creating a ruby script with domain models. Do i have to place the domain models under the module though?
[00:08:54] marz_d`ghostman: like I have a gem rise-mirror_manager. So there would be modules Rise::MirrorManager
[00:09:09] marz_d`ghostman: Should I place the domain model under Rise::MirrorManager::?
[00:15:46] havenwood: marz_d`ghostman: My guess from what you've said would be yes.
[00:16:17] sanscoeur: has joined #ruby
[00:16:22] havenwood: marz_d`ghostman: It's right for rise-mirror_manager to be Rise::MirrorManager, and if you need additional classes or modules they should be namespaced under Rise::MirrorManager::.
[00:17:14] weaksauce: has joined #ruby
[00:18:37] marz_d`ghostman: havenwood: okay thanks. When testing though, how do I make it so I wont have to define Rise::MirrorManager::Model.new? just Model.new?
[00:21:00] chichouw: has joined #ruby
[00:21:27] havenwood: marz_d`ghostman: I'd tend toward using the explicit, full namespace. That said, you can: include Rise::MirrorManager
[00:21:39] marz_d`ghostman: havenwood: I see
[00:21:46] havenwood: marz_d`ghostman: include Rise::MirrorManager; Model.new
[00:21:49] jottr: has joined #ruby
[00:22:18] havenwood: marz_d`ghostman: If it's particularly repetitive, an include might make a lot of sense.
[00:31:20] jottr: has joined #ruby
[00:33:03] Dirak: has joined #ruby
[00:34:12] faitswulff: has joined #ruby
[00:37:21] bmurt: has joined #ruby
[00:40:46] chichouw: has joined #ruby
[00:43:05] LiftLeft2: has joined #ruby
[00:45:46] hays_: is it totally nuts to listen to 127.0.0.101 as another 'localhost'
[00:45:55] hays_: its a /8 subnet after all
[00:46:19] hays_: pinging it certainly doesn't work
[00:49:20] za1b1tsu: has joined #ruby
[00:51:11] Radar: has joined #ruby
[00:52:31] mynameisdebian: has joined #ruby
[01:00:34] chichouw: has joined #ruby
[01:00:49] connor_goodwolf: has joined #ruby
[01:03:09] kenichi: has joined #ruby
[01:04:22] Paraxial: has joined #ruby
[01:05:36] NightMonkey: has joined #ruby
[01:08:58] SanguineAnomaly: has joined #ruby
[01:08:58] venmx: has joined #ruby
[01:09:11] marz_d`ghostman: I added pg as a dependency on my gemspec via spec.add_dependency 'pg' but I"m getting an error when I run bundle exec rake --tasks https://gist.github.com/marzdgzmn/c5758adeb8a80cdaab669e5170629be6
[01:09:19] marz_d`ghostman: Did a bundle install --path .bundle
[01:14:08] havenwood: marz_d`ghostman: What do you get for?: gem sources
[01:16:36] havenwood: hays_: 127.0.0.101 is a loopback address.
[01:17:13] hays_: yeah. can't ping it like localost tho
[01:17:15] marz_d`ghostman: havenwood: Guess I needed the libpq-dev package installed on my system
[01:17:28] havenwood: marz_d`ghostman: Yup, that you would!
[01:17:43] havenwood: marz_d`ghostman: pesky build deps
[01:20:16] chichouw: has joined #ruby
[01:24:28] faitswulff: has joined #ruby
[01:27:01] havenwood: hays_: why does pinging 127.0.0.101 not work? do you have icmpv4 disabled?
[01:29:03] havenwood: hays_: It'd explain your scenario if icmpv4 is disabled but icmpv6 is not and and localhost is pinging ::1 instead of 127.0.0.1.
[01:30:51] darkhanb_: has joined #ruby
[01:33:54] hays_: havenwood: hmm I think I have to actually bind 127.0.0.101 to the lo interface
[01:34:01] hays_: that's what i was missing
[01:35:50] meinside: has joined #ruby
[01:39:51] chichouw: has joined #ruby
[01:40:26] white_lilies: has joined #ruby
[01:42:14] im0nde: has joined #ruby
[01:43:46] pskosinski: has joined #ruby
[01:50:57] SanguineAnomaly: has joined #ruby
[01:51:02] camilasan: has joined #ruby
[01:51:11] Paraxial: has joined #ruby
[01:53:59] jp: has joined #ruby
[01:59:23] anoonnn: has joined #ruby
[01:59:45] tristanp: has joined #ruby
[01:59:48] chichouw: has joined #ruby
[02:19:31] chichouw: has joined #ruby
[02:19:45] fluxAeon: has joined #ruby
[02:32:09] jottr: has joined #ruby
[02:34:26] chichouw: has joined #ruby
[02:37:24] za1b1tsu: has joined #ruby
[02:42:59] marz_d`ghostman: has joined #ruby
[02:43:19] marz_d`ghostman: I'm using standalone_migrations, and when running bundle exec rake db:new_migration[create_tablename], it seems that the command is nto found
[02:45:05] marz_d`ghostman: Okay, got it working with db:new_migration name=tableName
[02:49:36] TheBloke: has joined #ruby
[02:53:19] DoctorMonocular: has joined #ruby
[02:53:58] DoctorMonocular: I'm annoyed. I have a method that takes either single things or an array of things and starts by doing thing = Array(thing_or_things)
[02:54:07] DoctorMonocular: which works and is idiomatic
[02:54:14] chichouw: has joined #ruby
[02:54:28] DoctorMonocular: but when thing is a hash it fucks up by converting {a: :b} into [[:a, :b]]
[02:54:42] DoctorMonocular: I want [{a: :b}]
[02:54:50] DoctorMonocular: like it work with any other variable
[02:55:03] DoctorMonocular: is there some way to do that without uglying up my code?
[03:10:53] braincrash: has joined #ruby
[03:14:02] chichouw: has joined #ruby
[03:19:16] rrichardsr3: has joined #ruby
[03:23:20] gix: has joined #ruby
[03:28:24] lxsameer: has joined #ruby
[03:30:59] marz_d`ghostman: has joined #ruby
[03:31:04] marz_d`ghostman: How does this snippet work? https://gist.github.com/marzdgzmn/cbf3ec76550efe140dd17550071363c5
[03:31:09] marz_d`ghostman: what's with the <<*?
[03:31:50] baweaver: YML inheritance
[03:31:53] venmx: has joined #ruby
[03:31:59] baweaver: default plus this other stuff
[03:32:33] tristanp: has joined #ruby
[03:33:34] chichouw: has joined #ruby
[03:33:56] Nicmavr: has joined #ruby
[03:39:01] marz_d`ghostman: baweaver: thanks
[03:39:21] marz_d`ghostman: baweaver: though migration only created the table under development and not test
[03:41:13] marz_d`ghostman: Does rspec automatically use the test environment?
[03:41:22] marz_d`ghostman: or do I have to set that up?
[03:50:18] marz_d`ghostman: How do I db:migrate for test environment?
[03:52:01] dbugger_: has joined #ruby
[03:53:31] chichouw: has joined #ruby
[04:00:33] Koshian: has joined #ruby
[04:13:14] chichouw: has joined #ruby
[04:18:26] havenwood: marz_d`ghostman: Assuming you mean rails: RAILS_ENV=test rails db:migrate
[04:18:30] havenwood: ?rails marz_d`ghostman
[04:18:30] ruby[bot]: marz_d`ghostman: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[04:19:20] marz_d`ghostman: havenwood: I'm not using rails though, just plain ruby however, RAILS_ENV=test works :)
[04:19:25] tristanp: has joined #ruby
[04:20:02] anoonnn: has joined #ruby
[04:25:14] za1b1tsu: has joined #ruby
[04:29:50] VladGh: has joined #ruby
[04:33:02] jottr: has joined #ruby
[04:33:04] chichouw: has joined #ruby
[04:52:46] chichouw: has joined #ruby
[04:52:51] anoonnn: has joined #ruby
[04:53:46] duderonomy: has joined #ruby
[04:55:22] reber: has joined #ruby
[04:55:42] reber__: has joined #ruby
[04:56:23] reber: has joined #ruby
[05:03:37] DTZUZO_: has joined #ruby
[05:04:33] nickjj_: has joined #ruby
[05:12:31] chichouw: has joined #ruby
[05:15:55] havenwood: has joined #ruby
[05:16:23] Mike11: has joined #ruby
[05:32:18] chichouw: has joined #ruby
[05:37:18] aupadhye: has joined #ruby
[05:40:08] aufi: has joined #ruby
[05:42:55] FermiDirak: has joined #ruby
[05:52:01] chichouw: has joined #ruby
[05:55:49] dellavg_: has joined #ruby
[05:58:34] peirama: has joined #ruby
[06:03:35] donofrio_: has joined #ruby
[06:11:12] donofrio__: has joined #ruby
[06:11:46] chichouw: has joined #ruby
[06:13:07] snickers: has joined #ruby
[06:14:35] tdy: has joined #ruby
[06:29:49] tristanp: has joined #ruby
[06:31:32] chichouw: has joined #ruby
[06:33:50] jottr: has joined #ruby
[06:41:50] tdy: has joined #ruby
[06:43:24] cd: has joined #ruby
[06:46:39] dellavg_: has joined #ruby
[06:48:25] MoritaShinobu: has joined #ruby
[06:51:09] chichouw: has joined #ruby
[06:53:58] za1b1tsu: has joined #ruby
[07:06:17] olspookishmagus: has joined #ruby
[07:07:24] alem0lars: has joined #ruby
[07:08:45] AndreYuhai: has joined #ruby
[07:09:41] clemens3: has joined #ruby
[07:11:06] chichouw: has joined #ruby
[07:11:35] LiftLeft: has joined #ruby
[07:11:49] yohji: has joined #ruby
[07:13:02] LiftLeft: has joined #ruby
[07:18:34] lunarfyre7: has joined #ruby
[07:21:09] Aloy: has joined #ruby
[07:23:23] c0ncealed2: has joined #ruby
[07:27:23] ua: has joined #ruby
[07:30:51] chichouw: has joined #ruby
[07:33:50] olspookishmagus: has left #ruby: ()
[07:34:33] DoubleMalt: has joined #ruby
[07:34:37] olspookishmagus: has joined #ruby
[07:36:27] jp: has joined #ruby
[07:38:10] Bish: hellooooooooo
[07:45:09] jottr: has joined #ruby
[07:46:13] Bish: moin moin!
[07:47:59] yohji: has joined #ruby
[07:50:34] chichouw: has joined #ruby
[07:52:51] konsolebox: has joined #ruby
[07:55:30] venmx: has joined #ruby
[07:56:01] za1b1tsu: has joined #ruby
[07:56:50] Bish: nokogiri does convert <img alt=""... to <img alt>
[07:56:59] Bish: :o when i do it in a little test, it doesn't
[07:57:14] Bish: Nokogiri::HTML('<!doctype html><html><body><img alt=""></body></html>').to_htm
[08:01:03] Bish: i are confuse
[08:02:08] mnemon: Bish: why?
[08:02:34] mnemon: just turns it into more simpligied form if you don't have data in it.
[08:08:44] Freshnuts: has joined #ruby
[08:10:19] chichouw: has joined #ruby
[08:10:34] Freshnuts: has joined #ruby
[08:18:11] Bish: mnemon: well the programs i send it to have a problem with it
[08:18:23] Bish: so i would rather have the explicit version
[08:18:32] Bish: i mean, they're both correct
[08:20:17] _za1b1tsu_: has joined #ruby
[08:20:20] Bish: and because i was testing this i especially wonder why this doesnt happen to me
[08:20:42] Bish: it shouldn't be as unpredictable
[08:22:26] Bish: https://stackoverflow.com/questions/33524001/create-non-self-closed-empty-tag-with-nokogiri
[08:22:38] Bish: i've never seen this, yet i have written 2 programs doing both these things
[08:22:40] Bish: super odd
[08:25:06] lxsameer: has joined #ruby
[08:30:06] chichouw: has joined #ruby
[08:32:33] aupadhye: has joined #ruby
[08:33:55] jottr: has joined #ruby
[08:34:08] lxsameer: has joined #ruby
[08:41:49] anoonnn: has joined #ruby
[08:43:24] venmx: has joined #ruby
[08:45:17] quiqua: has joined #ruby
[08:50:50] idiocrash: has joined #ruby
[08:52:39] dbugger_: has joined #ruby
[08:56:48] tdy: has joined #ruby
[08:57:37] al2o3-cr: has joined #ruby
[08:57:57] ineb: Bish: Nokogiri::XML vs Nokogiri::HTML
[09:01:48] Bish: i am using HTML, which the cod eis
[09:02:37] ineb: Bish: can you reproduce that in any way? or is it just like that in your main program?
[09:02:49] Bish: it's odd, even if i use it on the "broken" system
[09:02:51] Bish: it doesn't do it
[09:02:52] clemens3: has joined #ruby
[09:03:01] Bish: it doesn't remove the alt="" thingie..
[09:03:15] Bish: but i have some code that walks over it.. i expect the error to be there
[09:03:17] ineb: but it looks like that in the html code?
[09:03:34] Bish: attribute.value,ph_info = URI.unescape(attribute.value).extract_with_regex(PlaceholderRex)
[09:03:36] ineb: maybe there is just <img alt />
[09:03:48] Bish: no.. there is alt="" and after i walk over it.. it's alt
[09:03:59] Bish: im guessing if nokogiri itself sets it.. it will do just "alt"
[09:04:08] Bish: but if it parses it like "alt="""
[09:04:15] Bish: it will not omit it
[09:09:07] mnemon: Bish: it just turns empty attributes to boolean attributes(no '=""', just the name)
[09:09:07] mnemon: or does it break it in some other way?
[09:09:07] Bish: but it doesn't seem to do that
[09:09:07] Bish: if it parsed it otherwise
[09:09:07] Bish: yeah, definetely
[09:09:07] Bish: the code i posted is the cause
[09:09:07] Bish: even attribute.value = attribute.value seems to "break" it
[09:09:07] Bish: >> require 'nokogiri'
[09:09:07] ruby[bot]: Bish: # => cannot load such file -- nokogiri (LoadError) ...check link for more (https://eval.in/1058919)
[09:09:07] ShekharReddy: has joined #ruby
[09:09:21] helpa: has joined #ruby
[09:09:27] Bish: interesting
[09:09:55] ineb: this is fixing it??
[09:10:23] Bish: nono.. if you leave out the scond command, the output is different
[09:10:27] Bish: even though i say x = x
[09:10:42] Bish: wouldn't expect this
[09:12:07] chichouw: has joined #ruby
[09:12:21] Bish: the c-code seems to do that
[09:17:21] ineb: whats troubling me is that you cant reproduce it
[09:17:32] ineb: therefore i think you are missing something
[09:17:38] ineb: and its not nokogiris fault
[09:17:42] ineb: but iam not sure ofc
[09:18:26] ineb: maybe carefully compare the questionable node on your broken system to a healthy one
[09:18:37] ineb: there may be some subtle difference whats causing nokogiri to parse it that way
[09:18:43] ineb: *render it thay way
[09:20:43] Bish: just copy my code
[09:23:15] Bish: attribute.value = new_value unless attribute.value == new_value
[09:23:21] Bish: this basicially fixes it for me
[09:23:30] Bish: kinda pointless code, but it does the trick
[09:24:54] Radar: has joined #ruby
[09:28:26] chichou: has joined #ruby
[09:30:50] Stan: has joined #ruby
[09:33:23] ineb: Bish: if you use #to_xhtml, you always get alt="" style
[09:33:44] Bish: what other differences are there for xhtml?
[09:33:46] Bish: i never knew
[09:35:40] ineb: Bish: thats just what iam observing here
[09:35:47] ineb: it does look like a bug to me now
[09:36:03] Bish: i just feel weird that
[09:36:06] Bish: value = value
[09:36:11] Bish: changes something in the result
[09:36:29] Bish: and you can't really see it in the object-state
[09:38:19] ineb: have a look at https://github.com/sparklemotion/nokogiri/blob/master/ext/nokogiri/xml_attr.c#L9
[09:39:38] ineb: the new content gets encoded and i dont think thats the reason why value = value changes something
[09:40:02] ineb: i think THAT IS the reason
[09:41:12] ineb: but it does not look like you can seen this difference in ruby code
[09:41:12] Bish: yeah i figured
[09:41:23] Bish: that's what i said
[09:41:28] Bish: 11:11 < Bish> the c-code seems to do that
[09:41:41] ineb: so we make the same conclusion
[09:42:41] ineb: go file it as bug. its ambiguous behaviour.
[09:43:52] Bish: i don't know.. both are correct htmls, but it really strikes me odd
[09:44:31] ineb: its correct html and not fatal but ambiguous behaviour and not intended that way
[09:44:45] ineb: plus to_xhtml and to_html render it differently which points to another issue
[09:45:26] ineb: nokogiri authors are glad if you open an issue about that.
[09:48:22] Bish: okay, will do
[09:54:17] tuor: has joined #ruby
[09:57:35] chichou: has joined #ruby
[10:02:56] rupam123456: has joined #ruby
[10:06:18] xfbs: has joined #ruby
[10:14:53] FernandoBasso: has joined #ruby
[10:25:15] apparition: has joined #ruby
[10:26:56] g-: has joined #ruby
[10:27:58] venmx: has joined #ruby