baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview2: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
graphene has joined #ruby
baweaver_away is now known as baweaver
ur5us has joined #ruby
venmx has quit [Ping timeout: 268 seconds]
blackmesa has quit [Quit: WeeChat 2.2]
ur5us has quit [Ping timeout: 268 seconds]
BrainWork has quit [Ping timeout: 260 seconds]
orbyt_ has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
elphe has quit [Ping timeout: 244 seconds]
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rwb has joined #ruby
bmurt has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
nowhere_man has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
c0ncealed3 has quit [Remote host closed the connection]
c0ncealed3 has joined #ruby
elphe has joined #ruby
thejs has joined #ruby
jp has joined #ruby
druonysus has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
druonysus has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BTRE has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
thejs has quit [Quit: Leaving]
pskosinski has quit [Ping timeout: 240 seconds]
pskosinski has joined #ruby
cagomez has joined #ruby
wojnar has quit [Remote host closed the connection]
esrse has joined #ruby
znz_jp has quit [Remote host closed the connection]
znz_jp has joined #ruby
grvgr has joined #ruby
thomasfedb has quit [Ping timeout: 245 seconds]
grvgr has quit [Ping timeout: 252 seconds]
grvgr has joined #ruby
cd has quit [Quit: cd]
nowhere_man has quit [Ping timeout: 245 seconds]
bga57 has quit [Quit: Leaving.]
grvgr has quit [Quit: grvgr]
darkhanb has joined #ruby
bga57 has joined #ruby
orbyt_ has joined #ruby
AJA4350 has quit [Quit: AJA4350]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu has joined #ruby
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
cagomez has quit [Remote host closed the connection]
i8igmac has joined #ruby
<i8igmac> havenwood: i have a little snip, i constantly use when building a large uniq buffers. maybe there is the correct way of doing it lol
<i8igmac> buff=[]; File.read(junk).split{|x| if not buff.include?(x); buff<<x; end}
<i8igmac> this is something i constantly do.. it works just fine, but i think its ugly and slow.
Puffball has joined #ruby
<havenwood> i8igmac: It looks like a Set would be a good data structure to use there.
<i8igmac> ill read up on set
<havenwood> i8igmac: require 'set'; buff = Set.new; File.read(junk).split { |word| buff << word }
<baweaver> havenwood: So now they're all set?
<havenwood> baweaver: But not Go-lang, so not set to go.
<za1b1tsu> From what I reading the only XML type formats libraries that ruby includes by default are: xml, json, yaml. Is this correct? Because I'm looking for a format like json, but without the quotes, but don't want to use an extra gem. Any advice?
<havenwood> za1b1tsu: Marshal is another serializer that ships with Ruby.
<havenwood> za1b1tsu: What langs are you going between?
<havenwood> za1b1tsu: Say more about the quotes issue you have with JSON?
<i8igmac> lol thats cool havenwood ;-) i added 41,000 uniq words with set in like 1 second
<i8igmac> i like it
<za1b1tsu> havenwood: so I'm using just ruby, I need to save, load, edit some data from a file. I don't need quotes for strings.
<za1b1tsu> havenwood: SORRY, what I meant was I don't need quotes for keys!
<za1b1tsu> I want to save data live element1, element2 etc. Where element type is hash with some keys {name: "dasda", occupation: "dasdad"...}
<za1b1tsu> *I want to save data like
<havenwood> za1b1tsu: Ruby ships with PStore and YAML::Store, which wrap Marshal and YAML respectively and provide transactional file storage in those formats.
<za1b1tsu> If I use json it will be like {"name":"fasfa"...
<za1b1tsu> hmm lemme check out PStore, thanks havenwood, can I buy you a capuccino?
<havenwood> za1b1tsu: I have a tiny gem that wraps around PStore, but you really don't need a gem since it's easy to use directly: https://github.com/havenwood/persist#persist
<baweaver> you'd have more luck with a gibraltar
<havenwood> za1b1tsu: Are you wanting to read back all the data at once, or piecemeal?
<havenwood> za1b1tsu: Do you need to be able to access the value for a single key?
<za1b1tsu> havenwood: I need both, sometimes i need all elements. Sometimes I need just the last element
<za1b1tsu> the file will be like an array of elements, and each element is a hash
<havenwood> za1b1tsu: Then I'd suggest considering YDBM, which provides a String key lookup for YAML-serialized values in Berkeley DB: https://docs.ruby-lang.org/en/2.5.0/YAML/DBM.html
<havenwood> za1b1tsu: It ships with Ruby in the stdlib, you can use it like a Hash, and it doesn't have to read the whole data-set into memory to get at one value.
<havenwood> The caveat is that your keys must be Strings.
dellavg_ has joined #ruby
<za1b1tsu> so quotes right?
<havenwood> za1b1tsu: Quotes?
<za1b1tsu> "key":"value"
<za1b1tsu> not key: "value"
<havenwood> za1b1tsu: It doesn't serialize to either of those. You use it like: DB['key'] = 'value'
<havenwood> za1b1tsu: It takes Strings as the key, not Symbols. It serializes the values to YAML, but the keys are handled by the DB.
<havenwood> za1b1tsu: It sounds like you want to use Symbols as keys. You could certainly wrap YDBM to make it appear to work that way. Hell, that's even in the spirit of YDBM. :)
grenierm has joined #ruby
<havenwood> za1b1tsu: Sec, I'll write you a wrapper.
<havenwood> mm, the methods with blocks are harder
<havenwood> za1b1tsu: For just the getter/setter, all you'd need to do is: require 'yaml/dbm'; class Za1b1tsuDB < Psych::DBM; def [] key; super key.to_s end end
goldbox has joined #ruby
<goldbox> hi all
<havenwood> goldbox: hi
<orbyt_> So i've got a CSV i've parsed that has values like `3.390000`. I'm storing these in ActiveRecord as a :decimal. I noticed after it finished, that the values in my DB look like `0.339e1`.
<orbyt_> Is there a better data type to store these values?
<goldbox> anybody here develop ruby on windows?
elphe has quit [Ping timeout: 244 seconds]
<havenwood> orbyt_: Which DB? Postgres?
<orbyt_> Uh, whatever the default Rails is. MySQL i think
<havenwood> I think Sqlite is default?
<orbyt_> sqlite3, yea
vondruch has quit [Remote host closed the connection]
<orbyt_> shit i should change that lol
<havenwood> orbyt_: There are different implementations of :decimal depending on the RDBMS, is why I ask.
vondruch has joined #ruby
<orbyt_> Yea `adapter: sqlite3`
<havenwood> orbyt_: In Sqlite "the maximum supported :precision is 16" for :decimal, but there's no default.
dar123 has joined #ruby
graphene has quit [Ping timeout: 252 seconds]
<za1b1tsu> havenwood: I never heard of dbm before, so I was reading on it. So from what I understand the format is like this: key: elem, key: elem
<za1b1tsu> so basically it's big hash, correct?
<za1b1tsu> *a
<havenwood> orbyt_: There's a :float native type as well, if you're expecting a Float and not a BigDecimal.
<havenwood> orbyt_: Or you can set the :precision and :scale of your :decimal.
<orbyt_> havenwood I know Floats aren't ideal for accurate numbers/long decimals, though they are more performant
<havenwood> za1b1tsu: Yeah, like a Hash that you can store to disk, but still be able to read out a single key without having to load the whole Hash back into memory.
<orbyt_> These values are orbital parameters and such, so it's kind of important they are right
drale2k_ has joined #ruby
MoritaShinobu has joined #ruby
<havenwood> orbyt_: Haha, then a decimal sounds right. Postgres is the one implementation that allows a :precision of infinity. :)
<orbyt_> I'll fire up a rails project with postgres and check it out, thanks
<havenwood> orbyt_: Do you know how many significant digits there will be?
<orbyt_> ~10 decimal places or so
<havenwood> orbyt_: The inspect value your seeing is right for a BigDecmial. You can format it to print like a Float: BigDecimal.new('0.339e1').to_s 'f' #=> "3.39"
goldbox has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<havenwood> BigDecimal.new('0.339e1').to_s #=> "0.339e1"
<havenwood> orbyt_: Engineering notation "E" is the default, but conventional float "F" can be specified by that first #to_s param.
<orbyt_> How does it format it like a float but maintain the decimal places?
<havenwood> orbyt_: It's not converting to a Float with all that comes with that. It's just giving you a String with the correct digits in floating point notation.
<havenwood> orbyt_: For example, try: BigDecimal.new('0.1e-1_000_000_000').to_s 'F'
<havenwood> orbyt_: You'll notice zeros being printed for a VERY long time. :P
johnny56 has quit [Ping timeout: 272 seconds]
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elphe has joined #ruby
<orbyt_> :p
dar123 has joined #ruby
dellavg_ has quit [Ping timeout: 252 seconds]
elphe has quit [Ping timeout: 260 seconds]
DTZUZO has joined #ruby
kapil____ has joined #ruby
reber has joined #ruby
moei has quit [Read error: Connection reset by peer]
moei has joined #ruby
mattp_ has quit [Read error: No route to host]
mattp_ has joined #ruby
Cork has quit [Remote host closed the connection]
johnny56 has joined #ruby
Cork has joined #ruby
elphe has joined #ruby
tdy has quit [Quit: WeeChat 2.2]
elphe has quit [Ping timeout: 272 seconds]
sauvin has joined #ruby
<za1b1tsu> havenwood: DBM is not really a human readble format, right? Unless I'm doing something wrong. I can't just open the db file with a texteditor
<havenwood> za1b1tsu: You can open it with a text editor, but it's a binary format so it'll look like gibberish.
<havenwood> za1b1tsu: It's not human-readable.
<za1b1tsu> I see, well learned something new today
<havenwood> za1b1tsu: If you say more about what you're doing I bet we can give better suggestions.
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<za1b1tsu> a commandline note taker, notes are oganized in hashes: {text: "", name ""}
<za1b1tsu> you do note --add, and then takes your input and adds a note to notes.txt
<za1b1tsu> but I also want to give the option to edit them directly in the editor
<za1b1tsu> basically I'm searching for possible XML formats, less verbose and easy to read
<za1b1tsu> but I undestand the limitations now
dar123 has joined #ruby
<za1b1tsu> Im going to look into the Marshall thing you mentioned
<havenwood> za1b1tsu: Marshal is fast but it isn't human readable.
<za1b1tsu> oh
<za1b1tsu> so basically my options are: json or yaml, if I want to use the default ruby library
<havenwood> za1b1tsu: or XML
<havenwood> ;P
<havenwood> za1b1tsu: Or CSV
<za1b1tsu> hmmm
<za1b1tsu> csv
<za1b1tsu> now that is interesting
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
MIR100 has joined #ruby
apeiros_ has joined #ruby
ansraliant has joined #ruby
elphe has joined #ruby
code_zombie has quit [Read error: Connection reset by peer]
darkxploit has joined #ruby
yokel has quit [Ping timeout: 252 seconds]
Furai has quit [Quit: WeeChat 2.2]
Furai has joined #ruby
snickers has joined #ruby
dostoyevsky has quit [Ping timeout: 268 seconds]
yokel has joined #ruby
dostoyevsky has joined #ruby
clemens3 has joined #ruby
mike11 has joined #ruby
yokel has quit [Ping timeout: 268 seconds]
arkaros has joined #ruby
drale2k_ has quit [Quit: Textual IRC Client: www.textualapp.com]
Azure|dc has joined #ruby
Azure has quit [Ping timeout: 252 seconds]
yokel has joined #ruby
duderonomy has joined #ruby
clemens3 has quit [Ping timeout: 252 seconds]
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dar123 has joined #ruby
arkaros has quit [Ping timeout: 252 seconds]
arkaros has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
clemens3 has joined #ruby
nowhere_man has joined #ruby
arkaros has quit [Ping timeout: 252 seconds]
govg has quit [Ping timeout: 252 seconds]
arkaros has joined #ruby
snickers has quit [Quit: Textual IRC Client: www.textualapp.com]
aufi has joined #ruby
duderono_ has joined #ruby
duderonomy has quit [Ping timeout: 252 seconds]
duderono_ has quit [Client Quit]
yohji has joined #ruby
<za1b1tsu> So I am experimenting with reading files from bottom to top
nowhere_man has quit [Ping timeout: 250 seconds]
elphe has quit [Ping timeout: 268 seconds]
<za1b1tsu> If try fd.tell == 0 it crashes, if I try fd.tell ==1 it won't read the first character in the file (the last when reading backwards)
<apeiros_> == only compares…
<apeiros_> and what do you mean by "crashes"?
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
<za1b1tsu> apeiros_: it's in pastebin
<za1b1tsu> multiline error, I can't paste it here, would be spam
<za1b1tsu> *pasteofcode
<za1b1tsu> what I'm trying to do is read a file from bottom to top untill a match
arkaros has quit [Ping timeout: 246 seconds]
<apeiros_> ah, somehow I missed your paste link
<apeiros_> well, read(1) will move your position. not sure why it wouldn't read the last char if you do == 1, though.
<apeiros_> btw., reading 1 byte per iteration means that e.g. utf-8 will not be read correctly.
<apeiros_> not sure why you use loop instead of e.g. fd.size.times do …
<apeiros_> also that fd.read at the end…?
<apeiros_> just tried your code. reads the last char just fine with == 1, but of course your fd.read at the end won't (since read(1) moved your position by 1, which is why it is at 1 and not 0 anymore…)
lxsameer has joined #ruby
mr_rich101 has quit [Ping timeout: 272 seconds]
jidar_ has joined #ruby
arkaros has joined #ruby
mr_rich101 has joined #ruby
jidar has quit [Read error: Connection reset by peer]
jidar_ is now known as jidar
LiftLeft has quit [Ping timeout: 252 seconds]
<havenwood> za1b1tsu: This is less fun, but: File.open(filename) { |file| file.each_char.reverse_each { |char| puts char } }
DTZUZO has quit [Ping timeout: 252 seconds]
nowhere_man has joined #ruby
<apeiros_> it also reads the full file first :)
<za1b1tsu> yeah, I can't do that
<apeiros_> (which I would assume beats the purpose of the exercise)
apeiros_ is now known as apeiros
<za1b1tsu> apeiros: if I should not read 1 byte per iteration, how should I do it? The plan is to make a match
<za1b1tsu> if it maches "---" I want to stop
<havenwood> also i didn't read a single byte
<za1b1tsu> and retrieve the data until that point
<apeiros> za1b1tsu: if "-" is "\0x45", then you can treat it as binary and read byte by byte.
<apeiros> errr, not \x45, \x2d (== 45)
LiftLeft has joined #ruby
ansraliant has quit [Quit: My planet needs me]
bga57 has quit [Ping timeout: 244 seconds]
<za1b1tsu> is this better? I changed things based on your suggestions
<apeiros> eh, that's a rather terrible solution. you read 1 byte, then 2 bytes, then n bytes from the file
<apeiros> so worst case you read n^2 bytes
<apeiros> 1) open the file with binary encoding, else you'll get encoding errors
<apeiros> 2) read 1 byte at a time and buffer it up (it's probably more performant to read chunks of a couple of KB though, but IMO do that once you get it running with 1 byte reads)
<apeiros> 3) then do as you do now - test the first 3 bytes of your buffer
<apeiros> then if you got that running, rephrase your loop to have the "---" test + filesize as the loop condition instead of abusing break.
<apeiros> re 2), ensure your buffer is binary too. again, else you'll get encoding errors.
venmx has joined #ruby
esrse has quit [Ping timeout: 252 seconds]
Beams has joined #ruby
<marz_d`ghostman> I have a method that wraps a `` command, and when a Errno::ENOENT exception is raised, I'm logging it to a file. SInce the logger is another module's responsibility, I don't want to test it on the current class so instead I'm doing exit(1). How do I test that it terminates with exit_code 1? I'm currently trying .to terminate, but it's asking for argument, tried giving 0 but it doesn't work
DTZUZO has joined #ruby
<za1b1tsu> thanks for the awesome tips
<za1b1tsu> the only thing I don't understand "ensure your buffer is binary too"
<za1b1tsu> I return result.to_i or what?
<za1b1tsu> or I do result = (fd.read(1)).to_i + result.to_i
<apeiros> result.encoding should be binary. if it isn't, make sure it is.
<za1b1tsu> thank you apeiros
<apeiros> I'd probably write it like this:
<za1b1tsu> noice
<apeiros> note: both untested. but at the very least should help to get an idea.
<apeiros> depending on your usecase, you'll want to return "".b instead of nil. also depending on your use-case, you'll want to force_encoding to the actual encoding of the file at the end.
<marz_d`ghostman> http://termbin.com/hlrt Why am I getting wrong number of arguments error from this?
<apeiros> because included gets an argument.
<apeiros> &ri Module#included
<apeiros> ah, derpy still dysfunctional :(
<marz_d`ghostman> `included': wrong number of arguments (given 1, expected 0) (ArgumentError) It means I've given 1 and it expects 0 right?
<apeiros> yes
<marz_d`ghostman> that seems misleading
<apeiros> why?
<apeiros> it does get 1. your definition expects 0. it's exactly what's happening.
<marz_d`ghostman> If included needs to get an argument, that means it is expecting 1, and I have given 0?
<apeiros> no
<apeiros> the *protocol* expects you to define included as a method expecting 1
<marz_d`ghostman> apeiros: Ah I see
<apeiros> *you* method definition expects 0
<apeiros> *your
<marz_d`ghostman> so when I do include Logging, it is passing the current class as the argument
xfbs has joined #ruby
vondruch has quit [Ping timeout: 252 seconds]
<marz_d`ghostman> apeiros: How do I create instance variables for the class the includes a module?
<apeiros> instance variables are "created" by assigning to them. make sure you don't confuse class- and instance-level.
<marz_d`ghostman> apeiros: so basically, what I'm trying to do is assign a logger for each instance of a class. So I want to define it inside the self.included method of the module Logging
<marz_d`ghostman> cause include Module, creates instance methods for the object right?
<apeiros> it adds the included module as an ancestor of the class where you include it. the methods are available through inheritance. as if you'd subclassed a class.
<apeiros> and "for each instance" won't be possible within the self.included hook. think about it: which instances of your class are available at that point?
<marz_d`ghostman> apeiros: How do you suggest I do it?
<marz_d`ghostman> perhaps call another function that generates it?
ta_ has quit [Remote host closed the connection]
<apeiros> I don't know enough to make a sensible suggestion.
<apeiros> sounds like you want to set a logger at class level and delegate to the class from the instances.
<marz_d`ghostman> apeiros: So I have this sync class. Each instance will have its own log file
<marz_d`ghostman> and I want the logging mechanism to be exported to a module
<apeiros> and where are you stumbling?
arkaros has quit [Ping timeout: 252 seconds]
elphe has joined #ruby
za1b1tsu has quit [Ping timeout: 252 seconds]
arkaros has joined #ruby
dbz has joined #ruby
arkaros has quit [Ping timeout: 252 seconds]
dbz has quit [Ping timeout: 252 seconds]
za1b1tsu has joined #ruby
akosednar has quit [Ping timeout: 268 seconds]
jic has joined #ruby
akosednar has joined #ruby
AJA4350 has joined #ruby
<marz_d`ghostman> apeiros: on how to create the the logger for each instance of the class
xfbs has quit [Quit: afk]
xfbs has joined #ruby
ua_ has quit [Ping timeout: 246 seconds]
ua has joined #ruby
rishispeets has joined #ruby
arkaros has joined #ruby
GodFather has joined #ruby
rishispeets has quit [Client Quit]
rishispeets has joined #ruby
<rishispeets> Hey guys. I'm trying to make the global rbenv ruby installation my ruby in bash. I have added rbenv to my PATH but "which ruby" still points to the system install. Am I missing something?
<rishispeets> Hey all* ;)
kapil____ has quit [Quit: Connection closed for inactivity]
fluxAeon has joined #ruby
<apeiros> marz_d`ghostman: that's like waaaay to generic
<rishispeets> Ah, guess I needed to add shims file path besides the bin path to PATH.
lunarkitty has quit [Ping timeout: 252 seconds]
bkxd has quit [Ping timeout: 244 seconds]
aufi_ has joined #ruby
rishispeets has quit [Ping timeout: 244 seconds]
aufi has quit [Ping timeout: 246 seconds]
lunarkitty has joined #ruby
bkxd has joined #ruby
rishispeets has joined #ruby
arkaros has quit [Ping timeout: 252 seconds]
creat has quit [Ping timeout: 240 seconds]
alem0lars has joined #ruby
maufart__ has joined #ruby
creat has joined #ruby
aufi_ has quit [Ping timeout: 252 seconds]
alem0lars has quit [Ping timeout: 252 seconds]
arkaros has joined #ruby
Puffball has quit [Ping timeout: 246 seconds]
Puffball has joined #ruby
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby
rishispeets has quit [Ping timeout: 268 seconds]
jp has joined #ruby
ss942 has joined #ruby
bmurt has joined #ruby
<ss942> I have data like: [['first_value', 'secound_one'],['first_value_2','secound_value2'],['first_value3','sceound_value3']]
<ss942> How do I iterate through this?
cd has joined #ruby
Sembei has joined #ruby
rishispeets has joined #ruby
Pisuke has quit [Ping timeout: 252 seconds]
<go|dfish> ss942: depends on what you want to do exactly but: data.each { |first, second| ... }
rwb has quit [Ping timeout: 252 seconds]
<darkxploit> anyone ever install net-ssh. its a ruby ssh implementation ?
<darkxploit> i just clone from github https://github.com/net-ssh/net-ssh any idea how to install from source itself ?
mfunkmann has joined #ruby
bkxd_ has joined #ruby
alem0lars has joined #ruby
bkxd has quit [Ping timeout: 252 seconds]
<apeiros> darkxploit: usually it's `gem build *.gemspec && gem install *.gem`
<apeiros> but you can also try `rake -T` and see whether there's an install task.
TomyLobo has joined #ruby
Fusl has quit [Remote host closed the connection]
<darkxploit> apeiros: i freshly clone from git the net-ssh
kapil____ has joined #ruby
<darkxploit> apeiros: from what i understand i need the command gem right ?
Fusl has joined #ruby
<apeiros> darkxploit: yes. that comes with ruby, though.
<darkxploit> ok looks like i need to compile ruby
<apeiros> errr
<apeiros> d'uh
<apeiros> yes, of course you need ruby to use a ruby library
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
Cthulu201 has quit [Quit: Nowhere special. I always wanted to go there.]
mzo has joined #ruby
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #ruby
alem0lars has quit [Remote host closed the connection]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Cthulu201 has joined #ruby
mostlybadfly has joined #ruby
bga57 has joined #ruby
<darkxploit> help me please
<darkxploit> gem build *.gemspec ERROR: Loading command: build (LoadError) cannot load such file -- zlib ERROR: While executing gem ... (NoMethodError) undefined method `invoke_with_build_args' for nil:NilClass
bmurt has joined #ruby
<apeiros> zlib is part of the stdlib, it should be installed along with ruby. if it isn't, it means you built ruby without zlib support.
DTZUZO has quit [Ping timeout: 252 seconds]
<darkxploit> i use the following command: ./configure --prefix=/usr/local --with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usr
<darkxploit> then i made a make && make install
<apeiros> I don't build ruby myself, so can't really offer help with that. maybe somebody else in here can, though.
<apeiros> but I'd start with reading the output of those commands
<apeiros> might be it just skips stuff it doesn't find.
_yohji_ has joined #ruby
MoritaShinobu has quit [Ping timeout: 268 seconds]
yohji has quit [Ping timeout: 272 seconds]
marz_d`ghostman has quit [Ping timeout: 256 seconds]
rishispeets has quit [Ping timeout: 245 seconds]
rishispeets has joined #ruby
MoritaShinobu has joined #ruby
kristofferR has joined #ruby
rwb has joined #ruby
mfunkmann has quit [Quit: Textual IRC Client: www.textualapp.com]
Rapture has joined #ruby
mike11 has quit [Read error: Connection reset by peer]
rishispeets has quit [Ping timeout: 252 seconds]
dinfuehr has quit [Ping timeout: 244 seconds]
Nicmavr has quit [Write error: Connection reset by peer]
dinfuehr has joined #ruby
rishispeets has joined #ruby
Nicmavr has joined #ruby
gregf_ has joined #ruby
akaiiro has quit [Remote host closed the connection]
mzo has quit [Ping timeout: 240 seconds]
im0nde has joined #ruby
akaiiro has joined #ruby
bkxd_ has quit [Ping timeout: 252 seconds]
akaiiro has quit [Remote host closed the connection]
I0 has quit [Remote host closed the connection]
venmx has quit [Ping timeout: 252 seconds]
zapata has quit [Read error: Connection reset by peer]
zapata has joined #ruby
troys has joined #ruby
dbz has joined #ruby
gnufied has quit [Quit: Leaving]
marz_d`ghostman has joined #ruby
dbz has quit [Ping timeout: 245 seconds]
za1b1tsu has quit [Ping timeout: 268 seconds]
<marz_d`ghostman> What's the correct grammar for this? expect_any_instance_of(Kernel).not_to receive(:`).with(cmd)
darkxploit has quit [Ping timeout: 256 seconds]
venmx has joined #ruby
grvgr has joined #ruby
gnufied has joined #ruby
axsuul has quit [Ping timeout: 260 seconds]
axsuul has joined #ruby
za1b1tsu has joined #ruby
elphe has quit [Ping timeout: 252 seconds]
za1b1tsu has quit [Ping timeout: 252 seconds]
elphe has joined #ruby
rishispeets has quit [Ping timeout: 244 seconds]
alem0lars has joined #ruby
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #ruby
alem0lars has quit [Max SendQ exceeded]
samort7 has joined #ruby
aufi_ has joined #ruby
rishispeets has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maufart__ has quit [Ping timeout: 252 seconds]
rippa has joined #ruby
savolla has joined #ruby
bmurt has joined #ruby
dbz has joined #ruby
xfbs has quit [Quit: afk]
ss942 has left #ruby [#ruby]
WA9ACE has quit [Remote host closed the connection]
ivanskie has joined #ruby
elphe has quit [Ping timeout: 268 seconds]
aupadhye has joined #ruby
<zxq2> one issue with dynamic langs is certain errors aren't detected unless the code path is traversed, like say a typo in a variable name or constant. is there some kind of static analysis tool for ruby that can detect this kind of error? are there any safeguards?
<dalpo> zxq2: I'm waiting for the public release of https://sorbet.run/ :)
lxsameer has quit [Ping timeout: 244 seconds]
za1b1tsu has joined #ruby
<zxq2> one of my commits slipped through code review with this problem, want to avoid it in the future.
<zxq2> would think it's relatively common in dynamic langs
aufi_ has quit [Ping timeout: 246 seconds]
<zxq2> i bet some IDEs do it
Azure|dc has quit [Quit: Oops.]
savolla has quit [Ping timeout: 246 seconds]
Azure has joined #ruby
Azure has quit [Client Quit]
dbz has quit [Remote host closed the connection]
optikalmouse has joined #ruby
za1b1tsu has quit [Ping timeout: 252 seconds]
<optikalmouse> how slow is the ruby interpreter (2.x) in reading files? if I have a 1000 line file that's read & evaluated, will that be slower to run than a 100 line file? or is the difference too small to notice?
<optikalmouse> I'm trying to figure out whether duplicate code removal and fewer lines of code have a *real* performance impact aside from the cognitive impact that they have
Azure has joined #ruby
grenierm_ has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kristofferR has quit [Quit: Textual IRC Client: www.textualapp.com]
kapil____ has quit [Quit: Connection closed for inactivity]
orbyt_ has joined #ruby
MoritaShinobu has quit [Quit: Leaving]
orbyt_ has quit [Client Quit]
clemens3 has quit [Ping timeout: 268 seconds]
Puffball has quit [Remote host closed the connection]
arkaros has quit [Ping timeout: 252 seconds]
grvgr has quit [Quit: grvgr]
gnufied has quit [Ping timeout: 252 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
darkhanb has joined #ruby
gnufied has joined #ruby
<jidar> optikalmouse: that sounds like it would take about 10 seconds to test
akem has quit [Quit: Leaving]
wojnar has joined #ruby
akem has joined #ruby
<optikalmouse> true, I just benchmarked the difference between map(&:downcase) and map {|x| x.downcase}, seems like there is a diff for blocks vs procs..and we have &:whatever littered all over our codebase heh
aupadhye has quit [Quit: Leaving]
ua_ has joined #ruby
aupadhye has joined #ruby
dar123 has joined #ruby
ua has quit [Ping timeout: 272 seconds]
<optikalmouse> jidar: thanks for the help
<optikalmouse> user system total real
<optikalmouse> 144 lines 0.000000 0.000000 0.000000 ( 0.000182)
<optikalmouse> 1943 lines 0.000000 0.000000 0.000000 ( 0.000323)
_yohji_ has quit [Remote host closed the connection]
<optikalmouse> looks like 10x lines is just a 2x change? at least with File.read
<jidar> run the tests a few times
<jidar> I found a bit of caching happening on the OS when doing it only once or twice
aupadhye has quit [Client Quit]
aupadhye has joined #ruby
aupadhye has quit [Client Quit]
<optikalmouse> good point, will give that a go :D
grvgr has joined #ruby
grvgr has quit [Client Quit]
sameerynho has joined #ruby
bmurt has joined #ruby
Beams has quit [Quit: .]
arkaros has joined #ruby
za1b1tsu has joined #ruby
arkaros has quit [Ping timeout: 252 seconds]
nowhere_man has quit [Ping timeout: 252 seconds]
optikalmouse has quit [Quit: optikalmouse]
dbz has joined #ruby
za1b1tsu has quit [Ping timeout: 268 seconds]
venmx has quit [Ping timeout: 244 seconds]
za1b1tsu has joined #ruby
sgen has joined #ruby
SeepingN has joined #ruby
dbz has quit [Remote host closed the connection]
spiette has quit [Quit: ZNC 1.7.1 - https://znc.in]
spiette has joined #ruby
spiette has quit [Client Quit]
elphe has joined #ruby
jp has joined #ruby
conta1 has joined #ruby
samort7 has quit [Read error: Connection reset by peer]
elphe has quit [Ping timeout: 268 seconds]
spiette has joined #ruby
xfbs has joined #ruby
elphe has joined #ruby
za1b1tsu has quit [Ping timeout: 272 seconds]
elphe has quit [Ping timeout: 245 seconds]
duderonomy has joined #ruby
P1RATEZ has joined #ruby
cthulchu has joined #ruby
cthulchu has quit [Remote host closed the connection]
cthulchu_ has quit [Quit: Leaving]
cthulchu has joined #ruby
doubledup has joined #ruby
istrasci has joined #ruby
elphe has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elphe has quit [Ping timeout: 252 seconds]
rishispeets has quit [Quit: WeeChat 1.9.1]
rishispeets has joined #ruby
akem has quit [Remote host closed the connection]
akem has joined #ruby
<rishispeets> exit
sauvin has quit [Read error: Connection reset by peer]
Puffball has joined #ruby
akem has quit [Read error: Connection reset by peer]
akem has joined #ruby
creat has quit [Quit: ZNC - http://znc.in]
alireza has joined #ruby
creat has joined #ruby
arkaros has joined #ruby
<alireza> Which name is a better name for class that formats a ActiveRecord::Exception to a JSON
<alireza> ErrorJSONFormatter
<alireza> JSONErrorFormatter
elphe has joined #ruby
<alireza> what would you prefer a class that formats an specific series of exceptions to JSON
code_zombie has joined #ruby
<alireza> err, what would you call/prefer to call
<cthulchu> folks, I'm trying to read a file, but this file is gonna be written to at the same time
<cthulchu> I think it's fine cuz I'm still allowed to read a file even if someone else is writing into it, right?
arkaros has quit [Ping timeout: 246 seconds]
alireza has quit [Quit: WeeChat 2.1]
akem has quit [Remote host closed the connection]
akem has joined #ruby
elphe has quit [Ping timeout: 252 seconds]
rishispeets has quit [Ping timeout: 245 seconds]
howdoicomputer has joined #ruby
elphe has joined #ruby
xfbs has quit [Quit: afk]
elphe has quit [Ping timeout: 252 seconds]
venmx has joined #ruby
howdoicomputer has quit [Quit: WeeChat 2.2]
fredlinhares has joined #ruby
nowhere_man has joined #ruby
elphe has joined #ruby
xfbs has joined #ruby
<cthulchu> what does a colon mean before a variable?
dar123 has joined #ruby
<cthulchu> like a = :b?
<cthulchu> errr
<fredlinhares> cthulchu: it's a 'symbol'
krawchyk has joined #ruby
<apeiros> that it isn't a variable. it's a Symbol literal. like "b" is a String literal and 12 is an Integer literal.
DTZUZO has joined #ruby
elphe has quit [Ping timeout: 268 seconds]
<cthulchu> oh, okay
<cthulchu> it's just I always use quotes to cast into string
<cthulchu> well kinda
<cthulchu> I guess ruby doesn't care about them
<fredlinhares> cthulchu: no, Symbols are not strings.
<apeiros> yeah, using quotes doesn't "cast" a symbol into a string. you just have a string from the get go.
<cthulchu> anyhow. It lets me do things in a comfortable way and I'm grateful for that
<cthulchu> errr
<apeiros> :foo is not the same as "foo" just as 12 is not the same as "12".
<cthulchu> :b is not ":b"?
<apeiros> no
<cthulchu> what is a symbol?
<apeiros> please google. in short, it's a number which has a string "attached".
arkaros has joined #ruby
<fredlinhares> Symbol is a kind of "universal enum"
<apeiros> it's used internally for everything in ruby which has a name. `def foo` will internally create :foo, `class Bar` will create :Bar, `@foo = 12` will create :@foo
pulgolino has quit [Quit: WeeChat 0.4.2]
<cthulchu> wooooooow
<cthulchu> this is cool
doubledup has quit [Quit: Leaving]
<apeiros> I don't think enums are in the same category of things, since usually with enum you say "this value belongs to that enum", and you can't have a value which does not exist in "that" enum. neither is the case for symbols.
pulgolino has joined #ruby
elphe has joined #ruby
<cthulchu> so symbol means that the name goes after it
<cthulchu> the name that was defined before
<cthulchu> hm
<cthulchu> ok, I need to read about def :)
<apeiros> o0
<apeiros> it's the thing you use to define methods. you kinda should have seen that by now.
<cthulchu> oh, so it's just for methods?
<apeiros> it? def? yes, def is just to define methods.
<cthulchu> cool then
<fredlinhares> In ruby everything is object, so there is no pure functions, only methods.
<cthulchu> why do I have to explicitly say that it's a method?
<cthulchu> I usually call methods just like that
<cthulchu> with no :
<cthulchu> a()
<cthulchu> errr
arkaros has quit [Ping timeout: 252 seconds]
<fredlinhares> def is to define a method, not to use it.
<apeiros> because different syntaxes fulfill different purposes.
<cthulchu> oh, right right
<cthulchu> forgot
<cthulchu> so when I say a = :b what ends up being in a?
<cthulchu> a link to b?
<cthulchu> or b?
<fredlinhares> a reference to :b
<cthulchu> ok, good
<apeiros> as always with assignments: an object. and in this case, an object which is a Symbol instance with the literal representation :b
<apeiros> (or the string value "b", the numeric value is determined at runtime)
elphe has quit [Ping timeout: 272 seconds]
<cthulchu> okay
<cthulchu> very interesting
<cthulchu> thanks
spiette has quit [Quit: ZNC 1.7.1 - https://znc.in]
DTZUZO has quit [Quit: WeeChat 2.0]
DTZUZO has joined #ruby
spiette has joined #ruby
elphe has joined #ruby
conta1 has quit [Remote host closed the connection]
tdy has joined #ruby
elphe has quit [Ping timeout: 246 seconds]
fertapric has joined #ruby
sgen has quit [Ping timeout: 272 seconds]
DarthGandalf has quit [Quit: Bye]
DarthGandalf has joined #ruby
akem has quit [Remote host closed the connection]
akem has joined #ruby
dmitch has joined #ruby
elphe has joined #ruby
elphe has quit [Ping timeout: 260 seconds]
beowuff has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
elphe has joined #ruby
Vapez has joined #ruby
FernandoBasso has joined #ruby
elphe has quit [Ping timeout: 245 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Emmanuel_Chanel has quit [Ping timeout: 252 seconds]
<cthulchu> do we need to File.close?
nowhere_man has quit [Ping timeout: 268 seconds]
elphe has joined #ruby
<fredlinhares> cthulchu: no, because the code block will close for you.
<cthulchu> I suspected as much. wanted to make sure. Thanks a lot!
goldbox has joined #ruby
grenierm_ has quit [Quit: Page closed]
elphe has quit [Ping timeout: 246 seconds]
<goldbox> hi all
venmx has quit [Ping timeout: 252 seconds]
dmitch has quit [Read error: Connection reset by peer]
rwb has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
fertapric has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elphe has joined #ruby
elphe has quit [Ping timeout: 252 seconds]
goldbox has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
goldbox has joined #ruby
elphe has joined #ruby
Inline has quit [Quit: Leaving]
ta_ has joined #ruby
elphe has quit [Ping timeout: 252 seconds]
faitswulff has joined #ruby
ta_ has quit [Ping timeout: 268 seconds]
Eiam has quit [Ping timeout: 240 seconds]
elphe has joined #ruby
dinfuehr has quit [Ping timeout: 244 seconds]
dinfuehr has joined #ruby
venmx has joined #ruby
elphe has quit [Ping timeout: 252 seconds]
goldbox has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
goldbox has joined #ruby
fertapric has joined #ruby
reber has quit [Remote host closed the connection]
ur5us has quit [Read error: Connection reset by peer]
wojnar has quit [Remote host closed the connection]
rwb has joined #ruby
clemens3 has joined #ruby
arkaros has joined #ruby
elphe has joined #ruby
k0mpa has joined #ruby
arkaros has quit [Ping timeout: 272 seconds]
elphe has quit [Ping timeout: 268 seconds]
DTZUZO has quit [Ping timeout: 252 seconds]
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
elphe has joined #ruby
faitswulff has quit [Remote host closed the connection]
fertapric has left #ruby ["Textual IRC Client: www.textualapp.com"]
faitswulff has joined #ruby
ta_ has joined #ruby
faitswulff has quit [Ping timeout: 260 seconds]
faitswulff has joined #ruby
faitswulff has quit [Remote host closed the connection]
xfbs has quit [Quit: afk]
fertapric has joined #ruby
fertapric has left #ruby ["Textual IRC Client: www.textualapp.com"]
venmx has quit [Ping timeout: 252 seconds]
krawchyk has quit [Ping timeout: 244 seconds]
faitswulff has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ivanskie has joined #ruby
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
ivanskie has quit [Client Quit]
fredlinhares has quit [Quit: WeeChat 1.4]
ta_ has quit [Ping timeout: 246 seconds]
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #ruby
Vapez has quit [Read error: Connection reset by peer]
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #ruby
bkxd has joined #ruby
goldbox has left #ruby [#ruby]
faitswulff has quit [Ping timeout: 240 seconds]
moei has quit [Quit: Leaving...]
apeiros has quit []
elphe has quit [Ping timeout: 252 seconds]
clemens3 has quit [Ping timeout: 272 seconds]
code_zombie has quit [Quit: Leaving]
bkxd has quit [Ping timeout: 244 seconds]
elphe has joined #ruby
faitswulff has joined #ruby
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
faitswulff has quit [Ping timeout: 260 seconds]
lxsameer has joined #ruby
faitswulff has joined #ruby
lxsameer has quit [Ping timeout: 244 seconds]
sameerynho has quit [Ping timeout: 244 seconds]
bkxd has joined #ruby
arkaros has joined #ruby
faitswulff has quit [Remote host closed the connection]
faitswulff has joined #ruby
arkaros has quit [Ping timeout: 252 seconds]
dar123 has joined #ruby
faitswulff has quit [Ping timeout: 260 seconds]
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<cthulchu> hey
<cthulchu> folks, can I mutate line in f.each_line do |line|
<cthulchu> I mean, I don't mind doing l = line and then mutate l
<cthulchu> but... I would expect Ruby to continue to be flexible af
<sparc> Am I crazy for thinking the initialize executes before an object is instantiated?
<sparc> The docs seem to say it runs when class.new is called.
<sparc> Maybe I'm confused
<sparc> oh I get it. instance variable assignments, outside of methods, are executed earlier than initialize()
Puffball has quit [Remote host closed the connection]
<sparc> Is there ever a reason to define an @instance_var outside of initialize() ?
<SeepingN> so that's like a "do once when I load the class" thing? hmm
<cthulchu> these do/def-ends are just too difficult and awkward
<cthulchu> I wasted ten minutes to find where I fcked up
<cthulchu> still looking
<sparc> seepingN I think so
c0ncealed3 has quit [Remote host closed the connection]
<SeepingN> cthulchu: File.open() do or open.each_line .... you do not need to do a File.close
<SeepingN> the close is when you exit that block
<cthulchu> yeah
<cthulchu> I was answered
<cthulchu> thanks
<SeepingN> k
<SeepingN> oh now I see it sorry
c0ncealed3 has joined #ruby
<cthulchu> do you guys see anything wrong on this screenshot? https://i.imgur.com/rtGY049.png
<havenwood> cthulchu: else has red squiggles under it
<cthulchu> thanks, captain
<havenwood> cthulchu: note something funky the line above it re indentation
<cthulchu> yeah, thanks
<cthulchu> oops
<cthulchu> found it
<cthulchu> thanks
<havenwood> no prob
im0nde has quit [Ping timeout: 252 seconds]
<SeepingN> I think you can squish 2 lines into 1 with FIle.open().each_line do |line|
faitswulff has joined #ruby
cliluw has joined #ruby
SKINC-BMG1 has joined #ruby
<SKINC-BMG1> Hey guys
Puffball has joined #ruby
<SKINC-BMG1> I got a bitcoin wallet issue I was hoping someone could enlighten me about...
faitswulff has quit [Ping timeout: 252 seconds]
<SKINC-BMG1> nvm wrong channel sorry
ta_ has joined #ruby