« Back to channel list

#ruby - 15 January 2018

« Back 1 day Forward 1 day »
[00:00:10] drewmcmillan: has joined #ruby
[00:01:55] al2o3-cr: -Rn if you want line numbers too.
[00:03:06] skweek: has joined #ruby
[00:05:15] hays_: i think i prefer the latter way of using struct.new
[00:08:01] al2o3-cr: hays_: but don't forget this will create an anonymous class that will never be used.
[00:10:19] hays_: yeah that is weird, but it seems odd to be assigning classes like that
[00:12:09] al2o3-cr: the ideal way is really the former, but that's is up to you.
[00:12:55] GremL1N2: has joined #ruby
[00:14:50] hays_: is there any reason to prefer fred=Class.new do ... ?
[00:15:20] al2o3-cr: no, not really.
[00:18:15] jtdoncas: has joined #ruby
[00:18:28] al2o3-cr: hays_: also assign to constants.
[00:21:15] skweek: has joined #ruby
[00:22:26] al2o3-cr: >> [s = Struct.new(:a), S = Struct.new(:a), c = Class.new, C = Class.new]
[00:22:32] ruby[bot]: al2o3-cr: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[00:22:40] al2o3-cr: >> [s = Struct.new(:a), S = Struct.new(:a), c = Class.new, C = Class.new]
[00:22:46] ruby[bot]: al2o3-cr: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[00:22:59] naprimer: has joined #ruby
[00:25:46] belmoussaoui: has joined #ruby
[00:30:05] hays_: is this reasonable code? https://bpaste.net/show/dca8bc37f7fd
[00:32:28] hays_: i feel like i might be reimplementing something Ruby already has
[00:33:10] al2o3-cr: hays_: i don't see a problem with it, apart from my earlier comment.
[00:34:06] al2o3-cr: what is it you're trying to do anyway?
[00:34:23] havenwood: hays_: Consider: Foo = Struct.new(:bar, :baz, keyword_init: true); def initialize; yield_self if block_given? end
[00:34:43] havenwood: hays_: You'll be able to use kwargs or the block that way, with a nice ancestry.
[00:35:14] havenwood: hays_: Though if there's not more to it, I don't see the block as a win.
[00:35:31] al2o3-cr: havenwood: that's if they're using 2.5
[00:35:49] chouhoulis: has joined #ruby
[00:35:50] al2o3-cr: yes, i agree.
[00:35:58] hays_: that code.. missing a line?
[00:36:23] havenwood: hays_: nope, it works as written
[00:36:42] hays_: def initialize is at file scope?
[00:36:59] havenwood: Foo = Struct.new(:bar, :baz, keyword_init: true); def initialize; yield_self if block_given? end; Foo.new baz: 42, bar: 5
[00:37:00] bronson: has joined #ruby
[00:37:00] havenwood: #=> #<struct Foo bar=5, baz=42>
[00:38:24] havenwood: hays_: It's a block from the Struct.new
[00:38:45] hays_: im running 2.4 :) not sure I understand how that works.
[00:39:17] havenwood: >> Struct.new :x do; def example; end end
[00:39:19] ruby[bot]: havenwood: # => #<Class:0x41845a58> (https://eval.in/934798)
[00:39:39] jaequery: has joined #ruby
[00:39:59] havenwood: >> Struct.new :x do; def example; 42 end end.new.example
[00:40:00] ruby[bot]: havenwood: # => 42 (https://eval.in/934799)
[00:40:05] hays_: yeah that has a do in it
[00:41:33] havenwood: hays_: i didn't mean to omit the `do`, sorry for the confusion
[00:41:59] al2o3-cr: hays_: well spotted =)
[00:42:16] ResidentBiscuit: has joined #ruby
[00:42:23] hays_: just making sure i understand :) novice eyes
[00:43:22] hays_: what i don't understand about that code is if you don't give a block, then wouldn't you have overridden the initializer that allows for :baz and :bar to be initialized the other way?
[00:43:40] havenwood: hays_: I was lazy and didn't try my code, sec.
[00:44:52] hays_: the purpose of this code is nothing, just learning. but im trying to figure out a sensible coding style to hold myself to
[00:46:02] hays_: i like passing blocks to initialize because it creates relatively self-documenting code. whereas passing (non-keyword) args can sometimes feel arbitrary with the order of args
[00:46:24] havenwood: hays_: I usually only use structs when it's quite straightforward, otherwise a class quickly becomes appealing. I do like the keyword_init style they added in 2.5: https://gist.github.com/havenwood/8629ee099885b9671c89923949be9f0d
[00:47:28] al2o3-cr: another thing i like in 2.5 is Hash#slice
[00:47:35] hays_: im tempted to just pass blocks
[00:48:17] guille-moe: has joined #ruby
[00:48:21] hays_: but then you get to reimplementing enforcement of mandatory parameters
[00:49:25] IJsbrand: has joined #ruby
[00:49:45] havenwood: hays_: Yeah, your code was actually totally correct for what you're meaning to do. I do think the slightly-strange seeming constant assignment style is worth it rather than Class.new.
[00:50:00] MaksimPinigin: has joined #ruby
[00:51:22] alfiemax: has joined #ruby
[00:52:09] Yzguy: has joined #ruby
[00:52:31] chouhoulis: has joined #ruby
[00:53:02] r3kz: has joined #ruby
[00:54:36] jeffreylevesque: has joined #ruby
[00:55:22] Azure: has joined #ruby
[00:56:04] Jameser: has joined #ruby
[00:57:09] havenwood: hays_: Here's one that allows both kwargs and block at once, for fun: Foo = Struct.new(:bar, :baz, keyword_init: true) do; def initialize **kwargs; yield self if block_given?; super(to_h.merge(kwargs)) end end; Foo.new(bar: 42) { |f| f.baz = 84 } #=> #<struct Foo bar=42, baz=84>
[00:57:32] havenwood: (Actually check it this time. >.>)
[01:00:35] ap4y: has joined #ruby
[01:01:05] rrutkowski_: has joined #ruby
[01:03:14] hays_: i have to be careful of new ruby stuff. some of our installations probably have 2.2 or 2.3
[01:03:32] hays_: 2.5 must be new. i don't even have it on my machine
[01:03:52] guardianx: has joined #ruby
[01:05:30] Cork: has joined #ruby
[01:06:47] chouhoulis: has joined #ruby
[01:10:48] banisterfiend: has joined #ruby
[01:10:54] fmcgeough: has joined #ruby
[01:11:38] jnyw: has joined #ruby
[01:22:48] hays_: cool. 2.5 fixes something i always thought was annoying (securerandom)
[01:29:00] nadir: has joined #ruby
[01:36:33] bmurt: has joined #ruby
[01:50:08] cdg: has joined #ruby
[01:50:20] Azure: has joined #ruby
[01:53:01] Nicmavr: has joined #ruby
[01:54:33] alfiemax: has joined #ruby
[01:56:10] rrutkowski: has joined #ruby
[01:58:52] tamouse__: has joined #ruby
[01:59:10] nopolitica: has joined #ruby
[01:59:10] tamouse__: has left #ruby: ()
[02:06:04] rrutkowski: has joined #ruby
[02:12:35] rrutkowski: has joined #ruby
[02:14:28] alfiemax: has joined #ruby
[02:15:00] cschneid_: has joined #ruby
[02:18:20] rrutkowski: has joined #ruby
[02:22:13] therealGent: has joined #ruby
[02:22:15] rrutkowski: has joined #ruby
[02:25:53] rrutkowski: has joined #ruby
[02:26:38] gizmore|2: has joined #ruby
[02:30:51] rrutkowski: has joined #ruby
[02:30:55] armyriad: has joined #ruby
[02:33:23] hays_: oh, interesting. if I do Foo=Struct.new :bar, I access that with bar, not @bar
[02:34:24] armyriad: has joined #ruby
[02:36:15] rrutkowski_: has joined #ruby
[02:36:26] al2o3-cr: hays_: yep, because it creates accessor methods for you :)
[02:37:20] hays_: but it actually skips making the @foo thing
[02:37:42] hays_: or probably has it somewhere else, since as you said, its wrapped in an accessor
[02:37:54] bronson: has joined #ruby
[02:38:22] hays_: i guess that's good form since if there is an accessor, it should probably be used
[02:38:35] orbyt_: has joined #ruby
[02:39:36] raatiniemi: has joined #ruby
[02:39:52] al2o3-cr: aye, to read and write respectively
[02:40:32] cdg: has joined #ruby
[02:42:38] hays_: this doesn't seem the most portable way to add a binary to a gem: http://guides.rubygems.org/make-your-own-gem/#adding-an-executable
[02:43:36] Jameser: has joined #ruby
[02:44:38] hays_: it presupposes a unix environment and existence of /usr/bin/env
[02:45:50] rrutkowski: has joined #ruby
[02:51:12] nicesignal: has joined #ruby
[02:52:40] ahrs: has joined #ruby
[02:53:00] c0ncealed: has joined #ruby
[02:53:05] LocaMocha: has joined #ruby
[02:55:10] hays_: at least it would seem to
[03:11:50] alfiemax: has joined #ruby
[03:19:14] af1a7d: has joined #ruby
[03:19:57] af1a7d: has left #ruby: ("WeeChat 2.0.1")
[03:19:59] cdg: has joined #ruby
[03:21:05] Tempesta: has joined #ruby
[03:31:09] jnyw: has joined #ruby
[03:35:55] rrutkowski: has joined #ruby
[03:36:06] r3kz: has joined #ruby
[03:36:21] Jameser: has joined #ruby
[03:36:51] sanscoeur: has joined #ruby
[03:39:33] bronson: has joined #ruby
[03:41:01] rrutkowski: has joined #ruby
[03:50:00] jeffreylevesque_: has joined #ruby
[03:52:46] justinfaler: has joined #ruby
[03:57:18] jeffreylevesque: has joined #ruby
[04:02:00] justinfaler: has joined #ruby
[04:06:48] cschneid_: has joined #ruby
[04:06:49] cdg: has joined #ruby
[04:13:06] justinfaler: has joined #ruby
[04:15:13] orbyt_: has joined #ruby
[04:22:14] tastygradient: has joined #ruby
[04:23:02] govg: has joined #ruby
[04:34:16] jaequery: has joined #ruby
[04:36:04] alfiemax: has joined #ruby
[04:40:03] thejamespinto: has joined #ruby
[04:40:23] bronson: has joined #ruby
[04:43:15] cdg: has joined #ruby
[04:44:36] gix-: has joined #ruby
[04:47:11] iamarun: has joined #ruby
[04:48:35] tastygradient: has left #ruby: ()
[04:50:21] mjolnird: has joined #ruby
[04:50:46] anisha: has joined #ruby
[04:53:40] Dimik: has joined #ruby
[05:12:35] ur5us: has joined #ruby
[05:13:30] cajone: has left #ruby: ()
[05:16:45] Hexian_: has joined #ruby
[05:19:24] mikhael_k33hl: has joined #ruby
[05:20:09] epochwolf: has joined #ruby
[05:21:02] darkhanb: has joined #ruby
[05:30:07] iceden: has joined #ruby
[05:37:12] rrutkowski: has joined #ruby
[05:40:16] rrutkowski: has joined #ruby
[05:41:03] aupadhye: has joined #ruby
[05:41:17] bronson: has joined #ruby
[05:43:13] rrutkowski: has joined #ruby
[05:48:37] thejamespinto: has joined #ruby
[05:55:30] juggler: has joined #ruby
[05:57:08] cdg: has joined #ruby
[05:58:47] KeyJoo: has joined #ruby
[06:03:10] rrutkowski: has joined #ruby
[06:05:25] dinfuehr: has joined #ruby
[06:05:57] MaksimPinigin: has joined #ruby
[06:08:07] rrutkowski: has joined #ruby
[06:11:47] sanscoeur: has joined #ruby
[06:13:30] rrutkowski: has joined #ruby
[06:13:50] mikhael_k33hl: Is this the proper way to create a logger that logs to a different file for each instance of a class? https://gist.github.com/marzdgzmn/2e0e935f101bcd84a4016bc23df8c4d1
[06:17:57] cdg: has joined #ruby
[06:18:13] rrutkowski: has joined #ruby
[06:18:30] ali_g: has joined #ruby
[06:18:43] Kugz: has joined #ruby
[06:20:03] havenwood: Kugz: Like I was saying in #rubyonrails, those are each serialization formats - Marshal, JSON and YAML.
[06:20:28] havenwood: Kugz: There are multiple reasons why we have so many formats.
[06:21:09] havenwood: Marshal, for example, is Ruby-specific. It's not appropriate for sharing with other languages unless they implement Ruby's Marshal themselves.
[06:21:59] havenwood: JSON is a subset of YAML. JSON is human readable and can't serialize nearly as much as YAML, so it's safer.
[06:22:36] Kugz: It looks like YAML is escaping the characters or something at the end?
[06:22:53] havenwood: Kugz: those are newlines
[06:23:03] havenwood: it pretty-prints by default
[06:23:07] havenwood: you can get the JSON to do that
[06:23:13] mikhael_k33hl: How do I refer to the instance variable within a class from a module?
[06:25:04] havenwood: mikhael_k33hl: You can just reference them directly inside a module instance method.
[06:25:35] havenwood: Kugz: So you could just eval code, like: 42.inspect #=> "42"
[06:25:41] havenwood: eval "42" #=> 42
[06:26:02] mikhael_k33hl: havenwood: https://gist.github.com/marzdgzmn/2e0e935f101bcd84a4016bc23df8c4d1 I'm trying to use this module inside a class so I could dynamically assign a new logger for each instance but self refers to the module though
[06:26:08] havenwood: Kugz: But that's ^ extremely dangerous for user input, because they can run any code they want.
[06:26:24] mikhael_k33hl: havenwood: So basically inside a class I have @log = RsyncLogg.assign_logger
[06:26:29] havenwood: Kugz: Also, like Marshal, it doesn't work for sharing data across languages.
[06:26:38] havenwood: Kugz: So we have serialization!
[06:27:31] havenwood: Kugz: One you deserialize your JSON, it no longer matters that it *was* JSON. It becomes Ruby objects once deserialized, pure Ruby.
[06:27:45] Kugz: So does serialization convert the data into a uniform structure, so that no matter what language you use it's Ruby readable?
[06:28:07] havenwood: Kugz: It converts data specifically to text. Plain text.
[06:28:12] naprimer3: has joined #ruby
[06:28:38] Kugz: Oh, that's easy to understand. When you deserialise, can you specify what format to put it in (Marshal, YAML, JSON etc)?
[06:29:01] Kugz: (I'm Australian so it's autocorrecting the Z to an S sorry hahaha)
[06:30:14] havenwood: Kugz: So the serialized text is in a format, like JSON or MsgPack. When you deserialize it it becomes data in the language you're deserializing it to.
[06:31:01] iMadper: has joined #ruby
[06:31:05] havenwood: Kugz: So if we serialize something like 42 in any language, it'll be the same String that results.
[06:31:26] Kugz: Right. So would it convert { "data": { "field" : "example" } } to { data: { field : example } }?
[06:31:40] Kugz: Serialization*
[06:31:58] havenwood: Deserializing it in Ruby will be a Ruby `42` Integer, or in Objective-C it'll be an NSString, etc.
[06:32:39] havenwood: Kugz: JSON happens to be a readable format, so maybe it's a bit confusing. It's just text.
[06:33:03] havenwood: Kugz: Take a look at msgpack for example: https://msgpack.org/index.html
[06:33:59] havenwood: Kugz: MessagePack.dump(42) #=> "*"
[06:34:09] havenwood: Kugz: It turns `42` into `"*"`.
[06:34:28] havenwood: Kugz: Then every language it supports can turn that `"*"` into a native `42`.
[06:34:47] Kugz: Oh, that's a little strange. Why did it choose a wildcard symbol for the number 42?
[06:35:30] kapil___: has joined #ruby
[06:36:08] havenwood: Kugz: MessagePack is fast and small. It uses neat tricks to be concise like that and do it quickly.
[06:36:39] havenwood: Kugz: If you jump over to any of those other languages you can see you'll get 42 back.
[06:36:52] havenwood: Or from another Ruby on another machine.
[06:37:14] Kugz: All righty. So if I've got a bunch of JSON formatted data and I serialize it, it will be converted to plain text?
[06:38:10] Kugz: I found a method/function that is in built to ruby, I think it was JSON.parse(variable), is that the correct thing to do to serialize it?
[06:39:25] havenwood: Kugz: JSON.load is only meant for trusted data. JSON.parse is correct for external or user data.
[06:40:12] havenwood: JSON.load warning: "BEWARE: This method is meant to serialise data from trusted user input, like from your own database server or clients under your control, it could be dangerous to allow untrusted users to pass JSON sources into it."
[06:40:28] Kugz: So if you're fetching data from an external API it's best to use JSON.parse, but if you've got JSON data on your own server that can't be tampered with and you trust you use JSON.load?
[06:41:30] Kugz: So if you serialize data that has something malicious in it (might try to execute a database command for instance), will that stop it from happening?
[06:41:31] havenwood: Then JSON.dump or #to_json if you don't care if it's pretty for human readability, or JSON.pretty_generate if you do care.
[06:42:04] bronson: has joined #ruby
[06:43:03] havenwood: Kugz: JSON and MessagePack are two serialization formats that don't let you do much of anything, which tends to keep it safe.
[06:43:28] havenwood: Kugz: YAML, a superset of JSON, or Marshal can serialize quite malicious things fairly easily.
[06:43:58] havenwood: Eval can do *anything*.
[06:44:53] havenwood: #inspect and #eval are more homoiconicity than serialization - it's code *as* data rather than converted to data
[06:45:31] havenwood: i dunno, maybe the conversion is still considered serialization?
[06:46:02] havenwood: Kugz: But yeah, code to text. Text back to code. Varying degrees of danger!
[06:46:36] havenwood: Kugz: JSON.parse is safe with user-supplied JSON.
[06:46:55] havenwood: Kugz: Same with MessagePack.
[06:47:04] Kugz: Well that explains it pretty well :D I'm super sorry but I have to leave work now to catch my train, is there any way to contact you or should I just come back to this IRC channel later on (I don't use IRC much, first time really)
[06:47:20] havenwood: Kugz: I'm usually around, or someone else can probably help!
[06:47:24] havenwood: Kugz: Later!
[06:47:53] Kugz: thanks so much and have a good night!
[06:51:16] yeticry: has joined #ruby
[06:52:07] roshanavand: has joined #ruby
[06:53:02] ali_g: has joined #ruby
[06:53:55] roshanavand: has joined #ruby
[07:05:54] mikhael_k33hl: Does Logger automatically closes an opened file? http://ruby-doc.org/stdlib-2.1.0/libdoc/logger/rdoc/Logger.html
[07:09:17] anisha: has joined #ruby
[07:09:20] Dykam: has joined #ruby
[07:12:09] dionysus69: has joined #ruby
[07:18:31] al2o3-cr: mikhael_k33hl: yes.
[07:18:47] al2o3-cr: when you close the logger i mean.
[07:20:11] Ishido: has joined #ruby
[07:22:19] mikhael_k33hl: al2o3-cr: oh okay, so I'll just define the close method, or is there a better way to do it?
[07:23:36] al2o3-cr: `def close; @logger.close end` something like this
[07:24:18] Kugz: has joined #ruby
[07:26:23] Kugz: has joined #ruby
[07:27:10] mikhael_k33hl: al2o3-cr: but if the script is closed via ctrl+c, that method isn't invoked though right?
[07:27:13] conta: has joined #ruby
[07:27:19] ledestin: has joined #ruby
[07:30:25] iMadper: has joined #ruby
[07:32:22] russt: has joined #ruby
[07:35:45] Kero: has joined #ruby
[07:36:06] havenwood: trap('SIGINT') { close; exit 130 }
[07:36:06] andikr: has joined #ruby
[07:37:06] Kugz: has joined #ruby
[07:37:06] al2o3-cr: hey, that is actually the right code for sigint :)
[07:37:47] al2o3-cr: not many people use that.
[07:42:05] Kugz: havenwood: I'm back! Would it help if I uploaded what code I've got/tried to get my JSON stuff working?
[07:43:16] bronson: has joined #ruby
[07:43:26] Dykam: has joined #ruby
[07:44:40] Mia: has joined #ruby
[07:44:40] Mia: has joined #ruby
[07:50:49] havenwood: Kugz: Have a gist that shows the issue you're running into? I've got to go here in a sec but someone else might be able to help now or I'll check the backlog.
[07:51:40] Kugz: havenwood: I've had a bit of a breakthrough actually in the last 10 minutes, managed to get a single set of data to appear properly! Just need to figure out how to do a each statement for every entry now :D
[07:51:50] havenwood: >> fatal = 128; Signal.list['INT'] + fatal # al2o3-cr, mathy!
[07:51:55] ruby[bot]: havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[07:52:25] havenwood: Kugz: nice!
[07:53:21] Kugz: havenwood: I think there is something wrong with my JSON data that I have saved, when I copied it from the URL given (I only get 10 requests a day, so I thought I would save it locally) but it was all minified. When I copied just one character's worth of data and it wasn't minified, it seemed to work fine? My code editor shows the big list as if it was commented out, whereas the single amount of data is shown formatted and colored
[07:53:21] Kugz: correctly
[07:54:37] Kugz: havenwood: but it's not commented out, the file is 2.4MB so maybe that's an issue hahaha. It's a lot of data!
[07:55:56] Jameser: has joined #ruby
[07:59:26] alfiemax: has joined #ruby
[07:59:45] jsaak: has joined #ruby
[08:00:07] mark_66: has joined #ruby
[08:00:30] yokel: has joined #ruby
[08:04:12] dionysus69: has joined #ruby
[08:06:48] raatiniemi: has joined #ruby
[08:11:43] deathsparton: has joined #ruby
[08:12:09] ur5us: has joined #ruby
[08:19:27] iMadper: has joined #ruby
[08:25:33] jnyw: has joined #ruby
[08:26:21] darkhanb: has joined #ruby
[08:31:49] burgestrand: has joined #ruby
[08:32:47] claudiuinberlin: has joined #ruby
[08:33:08] belmoussaoui: has joined #ruby
[08:34:20] vondruch: has joined #ruby
[08:36:19] darkhanb: has joined #ruby
[08:37:38] InfinityFye: has joined #ruby
[08:40:34] InfinityFye: has left #ruby: ()
[08:41:37] alfiemax: has joined #ruby
[08:44:13] bronson: has joined #ruby
[08:44:18] Kugz: has joined #ruby
[08:51:06] alex``: has joined #ruby
[08:52:55] Kugz: has joined #ruby
[08:59:16] mikhael_k33hl: I've created a logger to a file, how do I set it to append logs realtime, it seems that it only appends logs after the process
[09:01:18] al2o3-cr: mikhael_k33hl: try setting sync = true
[09:05:59] al2o3-cr: mikhael_k33hl: you're writing to file right?
[09:08:19] al2o3-cr: if so, something like this; f = File.open('log', blah).tap { |f| f.sync = true }
[09:10:31] drewmcmillan: has joined #ruby
[09:15:51] mikhael_k33hl: al2o3-cr: yeah I am, sync = true? where do I set taht?
[09:18:17] amatas: has joined #ruby
[09:22:01] cschneid_: has joined #ruby
[09:22:41] ledestin: has joined #ruby
[09:23:49] roshanavand: has joined #ruby
[09:24:07] d_kam_: has joined #ruby
[09:35:37] al2o3-cr: mikhael_k33hl: gist what you have.
[09:37:07] guille-moe: has joined #ruby
[09:42:50] mikhael_k33hl: al2o3-cr: https://gist.github.com/marzdgzmn/e4e221f5255981c8c66e534d5e57af91
[09:44:29] johnpaul: has joined #ruby
[09:45:04] bronson: has joined #ruby
[09:45:55] InfinityFye: has joined #ruby
[09:46:09] al2o3-cr: mikhael_k33hl: under line 3 add: log_file.sync = true
[09:46:16] phaul: has joined #ruby
[09:48:46] mikhael_k33hl: al2o3-cr: thanks
[09:48:57] marr: has joined #ruby
[09:49:45] tAn: has joined #ruby
[09:51:24] thejamespinto: has joined #ruby
[09:51:30] Mortomes|Work: has joined #ruby
[09:53:34] dionysus70: has joined #ruby
[10:00:13] Beams: has joined #ruby
[10:01:22] tomphp: has joined #ruby
[10:03:06] Cavallari: has joined #ruby
[10:07:48] Serpent7776: has joined #ruby
[10:09:27] vichibit: has joined #ruby
[10:11:29] mikhael_k33hl: Anyone using sqlite3 gem? How do you inspect the query inside a statement? https://gist.github.com/marzdgzmn/fc8871857224559e43afde32baa2ee6a
[10:17:28] elphe: has joined #ruby
[10:20:51] _aeris_: has joined #ruby
[10:24:00] tomphp: has joined #ruby
[10:31:32] tomphp: has joined #ruby
[10:33:29] bkxd: has joined #ruby
[10:34:12] bkxd: has joined #ruby
[10:35:29] belmoussaoui: has joined #ruby
[10:40:35] ldnunes: has joined #ruby
[10:40:48] belmoussaoui: has joined #ruby
[10:41:32] nibbo: has joined #ruby
[10:43:58] darix: mikhael_k33hl: that works differently. this is not string replace, the library gets the query with the ???? and the array with params and fills it in. that happens inside the sqlite library
[10:44:27] tomphp: has joined #ruby
[10:45:42] bronson: has joined #ruby
[10:50:58] alfiemax: has joined #ruby
[10:51:22] amatas: has joined #ruby
[10:52:54] johnpaul: has left #ruby: ("Систем политик аметзит, крэтин щй ваи д ел.")
[11:00:19] Cavallari: has joined #ruby
[11:05:17] bkxd_: has joined #ruby
[11:17:30] AJA4350: has joined #ruby
[11:24:03] goatish: has joined #ruby
[11:25:00] Cavallari: has joined #ruby
[11:31:56] TinkerTyper: has joined #ruby
[11:36:04] mostlybadfly: has joined #ruby
[11:40:12] jaruga: has joined #ruby
[11:40:49] cdg: has joined #ruby
[11:43:49] KevinSjoberg: has joined #ruby
[11:46:39] bronson: has joined #ruby
[11:48:10] aufi: has joined #ruby
[11:51:29] thinkpad: has joined #ruby
[11:54:49] bkxd: has joined #ruby
[12:01:29] nopolitica: has joined #ruby
[12:03:01] Riddell: has joined #ruby
[12:03:06] fredx: has joined #ruby
[12:03:07] fredx_: has joined #ruby
[12:04:29] splargle: has joined #ruby
[12:04:48] TomyLobo: has joined #ruby
[12:07:52] Riddell: has joined #ruby
[12:14:46] amatas_: has joined #ruby
[12:14:50] KeyJoo: has joined #ruby
[12:17:08] belmoussaoui: has joined #ruby
[12:18:46] s3nd1v0g1us: has joined #ruby
[12:19:31] s3nd1v0g1us: has joined #ruby
[12:20:50] s3nd1v0g1us: has joined #ruby
[12:31:56] bkxd_: has joined #ruby
[12:47:23] bronson: has joined #ruby
[12:47:24] goatish: has joined #ruby
[12:48:53] Azure: has joined #ruby
[12:53:52] thejamespinto: has joined #ruby
[12:57:14] sepp2k: has joined #ruby
[13:00:08] Cavallari: has joined #ruby
[13:00:23] KeyJoo: has joined #ruby
[13:01:13] KevinSjoberg: has joined #ruby
[13:02:13] synthroid: has joined #ruby
[13:06:21] tcopeland: has joined #ruby
[13:06:45] Mia: has joined #ruby
[13:06:46] Mia: has joined #ruby
[13:09:41] fmcgeough: has joined #ruby
[13:18:20] chocoelho: has joined #ruby
[13:19:47] cdg: has joined #ruby
[13:20:33] s3nd1v0g1us: has joined #ruby
[13:24:54] rgr: has joined #ruby
[13:33:37] shinnya: has joined #ruby
[13:35:20] InfinityFye: has left #ruby: ("Leaving")
[13:37:17] hfp_work: has joined #ruby
[13:39:58] apparition: has joined #ruby
[13:48:39] bronson: has joined #ruby
[13:55:06] deathsparton: has joined #ruby
[14:02:03] k0mpa: has joined #ruby
[14:02:42] AgentVenom: has joined #ruby
[14:08:33] goatish: has joined #ruby
[14:09:08] cdg: has joined #ruby
[14:16:23] fmcgeough: has joined #ruby
[14:16:31] belmoussaoui: has joined #ruby
[14:20:56] troulouliou_div2: has joined #ruby
[14:29:39] Guest62716: has joined #ruby
[14:30:24] silpy: has joined #ruby
[14:32:00] QualityAddict: has joined #ruby
[14:39:52] LightStalker: has joined #ruby
[14:41:20] k0mpa: has joined #ruby
[14:42:31] LightStalker: has joined #ruby
[14:44:29] LastWhisper____: has joined #ruby
[14:45:47] govg: has joined #ruby
[14:47:02] tAn: has joined #ruby
[14:49:21] bronson: has joined #ruby
[14:49:32] rippa: has joined #ruby
[14:49:50] chocoelho: has joined #ruby
[14:51:07] nowhereman_: has joined #ruby
[14:52:21] Trel: If I want to host gems on an internal site to be freely downloadable by people who can reach the site, is there any document with the requirements I would need to set that up?
[14:52:41] thejamespinto: has joined #ruby
[14:53:23] Trel: I'm not familiar with ruby or the wordings to know what to search for to find this
[14:53:47] banisterfiend: has joined #ruby
[14:55:51] deathsparton: has joined #ruby
[14:56:40] tomphp: has joined #ruby
[14:58:29] deathsparton_: has joined #ruby
[15:00:46] depesz: has left #ruby: ("WeeChat 1.9")
[15:03:22] darix: Trel: "gem server"
[15:03:31] darix: is the search term you are looking for
[15:03:51] darix: Trel: gem help server
[15:03:56] darix: as a basic implementation
[15:04:54] Trel: Thanks, I'll google on that. I probably only need a basic one since it'll likely be a docker container
[15:05:05] tomphp: has joined #ruby
[15:06:02] Rapture: has joined #ruby
[15:06:46] netherwolfe: has joined #ruby
[15:07:35] zigzig: has joined #ruby
[15:09:19] splargle: has joined #ruby
[15:09:27] deathsparton_: has joined #ruby
[15:11:33] orbyt_: has joined #ruby
[15:11:53] KevinSjoberg: has joined #ruby
[15:15:12] mtkd: has joined #ruby
[15:15:45] tomphp: has joined #ruby
[15:16:36] Ishido: has joined #ruby
[15:16:49] s3nd1v0g1us: has joined #ruby
[15:17:24] s3nd1v0g1us: has joined #ruby
[15:21:03] oleo: has joined #ruby
[15:22:08] moei: has joined #ruby
[15:22:10] jtdoncas: has joined #ruby
[15:22:38] gnufied: has joined #ruby
[15:23:09] cschneid_: has joined #ruby
[15:29:21] Cavallari: has joined #ruby
[15:32:58] pastorinni: has joined #ruby
[15:35:57] troys: has joined #ruby
[15:39:10] cdg: has joined #ruby
[15:39:42] crankharder: has joined #ruby
[15:41:20] deathsparton_: has joined #ruby
[15:43:27] jeremy04: has joined #ruby
[15:44:05] tomphp: has joined #ruby
[15:48:39] Azure: has joined #ruby
[15:50:05] bronson: has joined #ruby
[15:50:50] Beams: has joined #ruby
[15:51:55] jtdoncas: has joined #ruby
[15:56:36] QualityAddict: has joined #ruby
[15:58:46] quobo: has joined #ruby
[15:58:50] cschneid_: has joined #ruby
[16:01:02] Guest62716: has joined #ruby
[16:03:44] linduxed: has joined #ruby
[16:04:10] chocoelho: has joined #ruby
[16:08:43] ur5us: has joined #ruby
[16:11:03] cdg: has joined #ruby
[16:11:26] dviola: has joined #ruby
[16:12:05] tAn: has joined #ruby
[16:15:36] KeyJoo: has joined #ruby
[16:16:18] belmoussaoui: has joined #ruby
[16:16:18] ali_g1: has joined #ruby
[16:17:43] synthroid: has joined #ruby
[16:25:37] jtdoncas: has joined #ruby
[16:29:31] kossae: has joined #ruby
[16:30:06] ltem: has joined #ruby
[16:36:10] oleo2: has joined #ruby
[16:38:34] yokel: has joined #ruby
[16:39:22] jeffreylevesque: has joined #ruby
[16:39:57] deathsparton_: has joined #ruby
[16:40:24] deathsparton_: has joined #ruby
[16:41:11] cdg: has joined #ruby
[16:49:08] enrique_webwork: has joined #ruby
[16:49:17] ghoti: has joined #ruby
[16:49:31] enrique_webwork: I get an error -bash: rbenv: command not found
[16:49:44] enrique_webwork: how do I remove this from the bash
[16:50:59] bronson: has joined #ruby
[16:57:53] havenwood: enrique_webwork: Are you typing?: rbenv
[16:58:21] havenwood: enrique_webwork: Tell us more about when you get the error. Do you mean to have rbenv installed?
[16:58:38] synthroid: has joined #ruby
[16:59:40] jtdoncas: has joined #ruby
[17:01:13] bhaak: has joined #ruby
[17:02:19] dionysus69: has joined #ruby
[17:03:37] JusticeFries: has joined #ruby
[17:04:20] Toggi3: has joined #ruby
[17:05:03] cdg: has joined #ruby
[17:06:17] cdg_: has joined #ruby
[17:06:31] minimalism: has joined #ruby
[17:07:26] cdg_: has joined #ruby
[17:08:57] Xiti: has joined #ruby
[17:09:15] roshanavand: has joined #ruby
[17:11:39] dhodgkin: has joined #ruby
[17:11:48] havenwood: alias rbenv="echo rbenv: command found"
[17:13:01] adaedra: :trollface:
[17:13:03] dminuoso: ACTION pokes havenwood with an oversized costate comonad coalgebra.
[17:14:14] dminuoso: havenwood: I recently learned about comonads, what a trivial but amazing notion! :)
[17:14:41] havenwood: I guess a troll alias should always unalias itself, and start with a space, to hide tracks.
[17:14:42] havenwood: alias rbenv="echo rbenv: command found && unalias rbenv"
[17:15:22] havenwood: dminuoso: Comonads in Ruby! \o/
[17:15:41] havenwood: ACTION ponders what a comonad is over coffee
[17:15:46] alfiemax_: has joined #ruby
[17:15:57] dminuoso: havenwood: A monad with its arrows reversed.
[17:16:43] dminuoso: Instead of: `m a -> (a -> m b) -> m b` you have `w a -> (w a -> b) -> w b`
[17:16:44] dminuoso: Which should tell you what a comonad is about.
[17:17:14] dminuoso: Im quite curious whether just staring at the type will bring you the revelation.
[17:18:37] dminuoso: And equivalently instead of `m (m a) -> m a` you get `m a -> m (m a)` and `m a -> a`
[17:19:09] enrique_webwork: <havenwood> the only refference of the rbenv is in the $PATH
[17:19:10] dminuoso: or rather `w a -> w (w a)` and `w a -> a`
[17:19:21] enrique_webwork: I get the error right after I login
[17:19:27] chouhoulis: has joined #ruby
[17:19:35] adaedra: Check your ~/.bashrc and ~/.bash_profile
[17:19:40] havenwood: enrique_webwork: It's likely in one of your dotfiles. What adaedra said.
[17:19:47] adaedra: ~/.profile ?
[17:19:49] havenwood: enrique_webwork: Check more dotfiles.
[17:19:54] enrique_webwork: no sign of of rbenv in those files
[17:19:56] Riddell: has joined #ruby
[17:20:12] mtkd: has joined #ruby
[17:20:14] adaedra: In related file in /etc?
[17:20:44] deathsparton_: has joined #ruby
[17:21:02] havenwood: enrique_webwork: what OS?
[17:21:12] deathsparton_: has joined #ruby
[17:21:17] dminuoso: havenwood: Essentially it models problems that somehow calculate values based on some "neighborhood", which is what that (w a -> b) is about. So given some large data structure `w a`, and some function that knows how to operate on a (usually) local neighborhood `w a -> b`, it applies it to the entire thing.
[17:21:20] enrique_webwork: no sign of rbenv in any of the /etc/ files
[17:21:21] havenwood: enrique_webwork: Did you check?: /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile and /etc/bash.bashrc?
[17:21:23] enrique_webwork: root@host ~]# $PATH
[17:21:23] enrique_webwork: -bash: /root/.rbenv/bin:/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin:/root/.rbenv/bin:/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin:/root/.rbenv/bin:/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin:/root/.rbenv/bin:/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin:/root/.rbenv/bin:/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin
[17:21:24] dminuoso: So things like image filters, automata
[17:21:35] enrique_webwork: so it's in the $PATH
[17:21:41] dminuoso: things you sadly never do in ruby
[17:21:44] havenwood: enrique_webwork: Do you see where it's being added to path?
[17:21:48] havenwood: dminuoso: mmmm
[17:22:27] enrique_webwork: no can't find it
[17:23:04] enrique_webwork: in my ~/bash_profile >> PATH=$PATH:$HOME/bin
[17:23:06] dminuoso: havenwood: and because of that things like `w a -> a` make sense, which simply extracts the current "focus/pivot point"
[17:23:38] havenwood: enrique_webwork: What OS are you on? Linux? MacOS or BSD?
[17:23:45] darkhanb: has joined #ruby
[17:23:47] dminuoso: and equivalently it can simply use `w a -> w (w a)` to replace each point with its neighborhood
[17:24:56] Riddell: has joined #ruby
[17:25:06] havenwood: enrique_webwork: I'd like to suggest commands but don't know whether to give you GNU or BSD.
[17:26:02] havenwood: enrique_webwork: Have `locate` installed? Try a: locate rbenv
[17:28:11] enrique_webwork: .rbenv is in one of the cPanel accounts home dir
[17:28:57] synthroid: has joined #ruby
[17:33:34] jtdoncas: has joined #ruby
[17:36:35] Zamyatin: has joined #ruby
[17:41:22] Yzguy: has joined #ruby
[17:51:48] bronson: has joined #ruby
[17:52:23] bmurt: has joined #ruby
[17:53:33] konsolebox: has joined #ruby
[17:54:06] chocoelho: has joined #ruby
[17:55:21] tomphp: has joined #ruby
[17:55:58] raatiniemi: has joined #ruby
[17:59:26] justinfaler: has joined #ruby
[18:04:03] jtdoncas: has joined #ruby
[18:04:50] coderead: has joined #ruby
[18:09:45] ur5us: has joined #ruby
[18:09:52] orbyt_: has joined #ruby
[18:10:09] akryll: has joined #ruby
[18:15:20] guille-moe: has joined #ruby
[18:16:19] aphprentice: has joined #ruby
[18:16:41] kossae: has joined #ruby
[18:19:14] _aeris_: has joined #ruby
[18:23:46] milardovich: has joined #ruby
[18:26:25] havenwood: has joined #ruby
[18:26:25] havenwood: has joined #ruby
[18:29:02] alfiemax: has joined #ruby
[18:30:28] alfiemax: has joined #ruby
[18:32:37] workmad3: has joined #ruby
[18:35:24] oleo: has joined #ruby
[18:38:50] sameerynho: has joined #ruby
[18:41:05] Dimik: has joined #ruby
[18:42:19] belmoussaoui: has joined #ruby
[18:46:40] tamouse__: has joined #ruby
[18:46:56] tamouse__: has left #ruby: ()
[18:47:26] rh10: has joined #ruby
[18:48:25] rh10: hey. guys, what is the best book to start work with ruby? for just beginner (i've never work with)
[18:48:31] Azure: has joined #ruby
[18:49:00] raynold: has joined #ruby
[18:52:37] bronson: has joined #ruby
[18:54:25] enrique_webwork: has left #ruby: ("Leaving")
[18:55:25] rh10: if there are some free books, it will be cool :)
[19:07:22] havenwood: rh10: Check the channel topic for a list of books!
[19:07:50] havenwood: rh10: Are you just new to Ruby or to programming altogether?
[19:08:19] havenwood: rh10: Brand new folk tend to like Chris Pine's Learn to Program (which I believe has some earlier editions free online).
[19:08:46] akryll: https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md#ruby
[19:08:57] havenwood: rh10: https://ruby-community.com/pages/links
[19:10:22] havenwood: rh10: https://goo.gl/wpGhoQ
[19:10:28] rh10: havenwood, thanks!
[19:10:43] rh10: havenwood, absolutely new
[19:10:55] havenwood: rh10: Welcome!
[19:12:24] belmoussaoui: has joined #ruby
[19:16:28] rh10: akryll, sorry, did not see instantly. thanks too
[19:16:51] rh10: ACTION has to change some color in irc client
[19:17:07] havenwood: akryll: Have you checked out TruffleRuby?
[19:17:44] havenwood: akryll: Also, Roda!
[19:18:08] zigzig: has joined #ruby
[19:18:10] havenwood: (Saw your Rails convo.)
[19:18:36] akryll: haha i already chosen techtopia to get back into ruby after all these years
[19:19:07] akryll: what did you think of that discussion man?
[19:19:26] havenwood: I just skimmed it, but I love talking Ruby performance!
[19:20:23] havenwood: akryll: CRuby has really had a nice focus on performance lately. Some of the neat JIT work might land soon, which give a great performance for memory tradeoff when that works for you.
[19:20:43] havenwood: akryll: JRuby continues to be production-ready and fast, when you have the memory and can spare the startup time.
[19:21:20] akryll: im glad i stayed in here to see you say this
[19:21:22] havenwood: akryll: TruffleRuby uses SVM to startup impressively fast, and then Graal for high level JIT.
[19:21:46] havenwood: It's not production ready for Rails yet, but actually runs almost everything and it seems like they're closing in!
[19:23:04] havenwood: It's a lot of fun to contribute to as well, since the core team is super active, give great feedback and much of it is implemented in Ruby.
[19:23:27] havenwood: https://github.com/graalvm/truffleruby
[19:23:43] akryll: what is svm?
[19:24:10] havenwood: akryll: SubstrateVM. It's an Oracle Labs research project that was recently open sourced.
[19:24:37] havenwood: akryll: https://github.com/graalvm/truffleruby/blob/master/doc/user/svm.md
[19:24:57] havenwood: "Using the SVM it is possible to ahead-of-time compile TruffleRuby and the Graal dynamic compiler to a single, statically linked native binary executable, that has no dependency on a JVM, and does not link to any JVM libraries."
[19:25:25] havenwood: akryll: The research areas are particularly exciting: https://github.com/graalvm/truffleruby/issues/343#issuecomment-318866606
[19:26:14] akryll: i just wanted to know if the community is still actively improving performance options for ruby and rails and you've let me know exactly that rails is perfectly fine to get into right now, appreciate it
[19:26:36] havenwood: akryll: Rails is doing great stuff. They're starting to focus more on performance.
[19:26:50] Ryzokuken: has joined #ruby
[19:26:52] havenwood: akryll: Ruby has a huge focus on it across different implementation teems.
[19:27:08] havenwood: akryll: Roda takes the performance crown, for Rack adapters - being fast and light.
[19:27:49] havenwood: akryll: The fastest thing in Ruby-land is actually on the mruby front, because they embed it in Nginx and then add caching for more speed.
[19:28:16] havenwood: akryll: http://roda.jeremyevans.net/
[19:28:24] havenwood: akryll: http://ngx.mruby.org/
[19:30:48] havenwood: akryll: ngx_mruby 360k, roda 180k and rails 20k - to give an idea on relative Hello World JSON performance: https://www.techempower.com/benchmarks/previews/round15/#section=data-r15&hw=ph&test=json
[19:31:22] fusta: has joined #ruby
[19:32:48] chocoelho: has joined #ruby
[19:37:44] _aeris_: has joined #ruby
[19:41:23] desperek: has joined #ruby
[19:46:43] Riddell: has joined #ruby
[19:48:13] tAn: has joined #ruby
[19:50:36] r3kz: has joined #ruby
[19:52:19] Riddell: has joined #ruby
[19:53:47] bronson: has joined #ruby
[19:55:16] kies: has joined #ruby
[20:00:19] xpt: has joined #ruby
[20:06:41] KevinSjoberg: has joined #ruby
[20:15:00] justinfaler: has joined #ruby
[20:16:02] kossae: has joined #ruby
[20:17:47] Axy: has joined #ruby
[20:17:47] Axy: has joined #ruby
[20:20:15] conceivably: has joined #ruby
[20:20:50] mtkd: has joined #ruby
[20:21:58] Riddell: has joined #ruby
[20:25:26] Dimik: has joined #ruby
[20:31:49] WA9ACE: has joined #ruby
[20:34:26] conceivably: Hi. I'm trying to call a new instance of each class whose file is in a given directory. In order to get a list of the classes within the folder /foo/bar/baz, I'm trying to use Foo.constants, Foo::Bar.constants, Foo::Bar::Baz.constants. However, mysteriously only some of the constants available in the respective modules get shown. Any ideas of what might be going on would be greatly appreciated :)
[20:35:04] SCHAPiE: has joined #ruby
[20:37:48] claudiuinberlin: has joined #ruby
[20:48:30] rikkipitt: has joined #ruby
[20:48:42] claudiuinberlin: has joined #ruby
[20:49:39] conceivably: Ah never I mind. I guess those constants weren't available from the point of call.
[20:52:35] drewmcmillan: has joined #ruby
[20:54:18] dviola: has joined #ruby
[20:54:36] bronson: has joined #ruby
[20:55:04] linetrace: has joined #ruby
[20:56:26] felideon: has joined #ruby
[20:56:36] felideon: has left #ruby: ("WeeChat 0.4.3")
[21:11:10] mtkd: has joined #ruby
[21:12:06] LastWhisper____: has joined #ruby
[21:18:43] miskatonic: has joined #ruby
[21:20:20] Toggi3: has joined #ruby
[21:23:37] akryll: has left #ruby: ()
[21:24:19] rikkipitt: has joined #ruby
[21:26:11] dwickern: has joined #ruby
[21:26:14] rouge: has joined #ruby
[21:27:09] TomyLobo2: has joined #ruby
[21:28:59] musl: has joined #ruby
[21:30:37] steveAT: has joined #ruby
[21:32:57] jtdoncas: has joined #ruby
[21:33:50] rikkipitt: has joined #ruby
[21:35:15] ur5us: has joined #ruby
[21:54:32] Trel: Ok, I'm stumped, what would cause a gem to show up with 'gem list' but not with 'gem which <gemname>'
[21:55:01] Stazer: has joined #ruby
[21:55:24] bronson: has joined #ruby
[21:55:46] mtkd: has joined #ruby
[22:03:22] justinfaler: has joined #ruby
[22:22:55] oleo: has joined #ruby
[22:23:52] alfiemax: has joined #ruby
[22:28:50] oleo: has joined #ruby
[22:31:15] Ishido: has joined #ruby
[22:39:39] kapil___: has joined #ruby
[22:41:42] drewmcmillan: has joined #ruby
[22:42:28] IJsbrand: has joined #ruby
[22:46:22] Xiti: has joined #ruby
[22:47:24] plexigras: has joined #ruby
[22:48:30] wnd: has joined #ruby
[22:54:19] cschneid_: has joined #ruby
[22:56:13] bronson: has joined #ruby
[22:58:20] zwliew: has joined #ruby
[23:01:47] WA9ACE: has joined #ruby
[23:04:07] sameerynho: has joined #ruby
[23:04:21] RougeR: has joined #ruby
[23:07:22] tomphp: has joined #ruby
[23:08:45] shinnya: has joined #ruby
[23:15:42] QualityAddict: has joined #ruby
[23:27:06] pilne: has joined #ruby
[23:27:55] oleo: has joined #ruby
[23:29:20] n0m4d1c: has joined #ruby
[23:31:43] jp: has joined #ruby
[23:35:10] goatish: has joined #ruby
[23:35:56] haylon_: has joined #ruby
[23:38:27] Azure: has joined #ruby
[23:38:29] naprimer: has joined #ruby
[23:42:20] belmoussaoui: has joined #ruby
[23:43:31] Kugz: has joined #ruby
[23:50:36] TomyLobo2: has joined #ruby
[23:51:24] nadir: has joined #ruby
[23:53:54] paulrf: has joined #ruby
[23:54:17] alfiemax: has joined #ruby
[23:57:03] bronson: has joined #ruby
[23:59:31] kossae: has joined #ruby