<John_Ivan>
though I could've sworn the last stackoverflow question mentioned that any zip gem should handle rar as well
<John_Ivan>
last so question I've read*
<John_Ivan>
"ffi-libarchive provides a gem-based solution. It works for rar files even though they don't specifically mention it (see issue #151). Add this to your application's Gemfile:"
<John_Ivan>
time to test that.
<weaksauce>
i don't know if there is a general un-raring thing
<John_Ivan>
weaksauce, if worst comes to worst, I'll just call the rar-cli directly as a new process.
<weaksauce>
yeah that's simple enough
<John_Ivan>
weaksauce, it seems ffi-libarchive has the same issue as Zip. "uninitialized constant Archive (NameError)" for Archive::EXTRACT_PERM
<John_Ivan>
the binary? nope. just installed the gem. I'm not running a *nix machine.
<weaksauce>
it's a FFI to that binary
<John_Ivan>
ah
<weaksauce>
which is "foreign function interface"
<weaksauce>
so it calls stuff from ruby into the C/etc world
<John_Ivan>
Understood. *slaps his own face*
<John_Ivan>
yeah. makes sense.
<John_Ivan>
weaksauce, but that aside, I'd expect it to throw a runtime error as opposed to a syntax/interpreter error, no?
<John_Ivan>
what is an uninitialized constant?
<weaksauce>
post the full stack trace in a gist or something
<weaksauce>
and i can tell you more
<weaksauce>
just means that something is not defined
<weaksauce>
could be that it failed to bind correctly and thus didn't create that constant (uppercase things in ruby that are generally classes or values)
<weaksauce>
just require "./unrar.rb" or whatever it is named in the same directory your script is on
<John_Ivan>
weaksauce, I will try that. my concern right now is however less to achieve my archiving goals, as much as it is to understand ruby.
michigan has joined #ruby
<John_Ivan>
I don't come from an scripted/interpreted/VHLL background
<weaksauce>
ah
<John_Ivan>
C.
<weaksauce>
well fileutils are useful
<John_Ivan>
I've noted that class, yeah. also, I've noticed there's no socket class. but `File` has a socket? method which means, I assume, that files will be treated as sockets, alongside the Io class.
<John_Ivan>
very unixy
<John_Ivan>
anyway, I'd like to make a list if you don't mind
<weaksauce>
net/http is more high level than socket
<John_Ivan>
eh? what's the difference
<John_Ivan>
between core and stdlib
<weaksauce>
core is the essentials like enumerable, array, hash
<John_Ivan>
ah. ok. I see. damn. I missed this completely. the stdlib page.
<John_Ivan>
I was looking only at core
<weaksauce>
i guess stuff that you'd need to make any program
<weaksauce>
the extra stuff like csv is out that way
<John_Ivan>
ok this makes a lot of sense now
<John_Ivan>
weaksauce, thanks for that, saved me a lot of trouble. now then, as I said, I'm trying to make a list of popular gems to complement the core/stdlib. anything that comes to mind?
<weaksauce>
the stdlib is still very used but not always
<weaksauce>
rake/minitest or rspec/bundler
<weaksauce>
rails/thor
<weaksauce>
set is useful sometimes
<weaksauce>
time is generally the one you want to use instead of Date or datetime
<weaksauce>
open3
<weaksauce>
net/http
<John_Ivan>
cheers
<weaksauce>
there's a ton really
<weaksauce>
Dir and File are useful
<weaksauce>
as are fileutils for copy/rename/remove etc
<weaksauce>
spend some time learning enumerable as that is hands down the most important thing in ruby
<weaksauce>
map/reduce/select/reject/etc
<John_Ivan>
weaksauce, sounds like iterator in C++.
<John_Ivan>
weaksauce, yeah, these are in stdlib. I was thinking, more like, external gems.
<John_Ivan>
stdlib/core*
<weaksauce>
ah
<weaksauce>
awesomeruby is something worth a browse
cornduck has quit [Remote host closed the connection]
cornduck has joined #ruby
lim has quit [Remote host closed the connection]
Guest74 has joined #ruby
perrierjouet has joined #ruby
<Guest74>
Hi everyone! Anyone here that could help me with finding the memory location of a ruby object? Before 2.7, this was easy with object_id, but this changed
<Guest74>
`FFI::Pointer.new(object_id * 2)` works for ruby 2.6 but not for 2.7+
roadie has joined #ruby
huma has quit [Ping timeout: 240 seconds]
Guest74 has quit [Quit: Client closed]
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
Al2O3 has quit [Remote host closed the connection]
bit4bit has joined #ruby
whysthatso12 has quit [Remote host closed the connection]
whysthatso12 has joined #ruby
huma has joined #ruby
sagax has quit [Quit: Konversation terminated!]
sagax has joined #ruby
fef has quit [Quit: Leaving]
tsujp has joined #ruby
RawFiend has joined #ruby
John_Ivan has joined #ruby
taupiqueur has quit [Quit: taupiqueur]
michigan has quit [Quit: Connection closed for inactivity]
<John_Ivan>
I sure hope I can do word().size(), right?
<John_Ivan>
nevermind. "Ruby tries hard not to require any syntax it can do without and a great example of this
<John_Ivan>
or omit the parentheses around the arguments. "
<John_Ivan>
is its treatment of parentheses. When you define or call a method, you are free to add
<John_Ivan>
thank god
<John_Ivan>
I mean
<John_Ivan>
thank Allah.
<John_Ivan>
and Anubis
<John_Ivan>
anyway. Chapter 2.
* John_Ivan
frowns
<John_Ivan>
right. not something I consider useful, or rather, not something I am willing to change.
<John_Ivan>
Chapter 3.
<adam12>
John_Ivan: IMHO, leave parenthesis off if there are no arguments, but use them if there are.
<adam12>
They are optional in most cases, but while you're learning, it's not worth determining when they can be left off. Or which arguments belong to which.
<adam12>
Or the worse, when a hash is passed as a block argument.
<John_Ivan>
adam12, I heed the advice. But I know what practice is objectively right or wrong when it comes to syntax choices.
<John_Ivan>
parentheses should not be optional. with or without arguments. that is my belief.
bit4bit has quit [Ping timeout: 256 seconds]
TCZ has joined #ruby
<John_Ivan>
---
bit4bit has joined #ruby
<John_Ivan>
"collection.each() do | arg | { }"
<John_Ivan>
to be used instead of for? eh. a bit of a meh. but sure. it's fair enough.
<adam12>
John_Ivan: `for` is there but it's not used that much. It has different semantics than the blocks, and you can't use it with Enumerable.
<adam12>
John_Ivan: Once you start using Enumerable methods you'll see why.
hololeap has joined #ruby
<John_Ivan>
adam12, I get the idea. just another <Iteration> API
<adam12>
John_Ivan: Sure. Many methods in Enumerable are chainable too, so you can compose operations.
<John_Ivan>
and is `while` as well less frequent as a result of `unless/until`?
hololeap has quit [Ping timeout: 276 seconds]
<weaksauce>
don't use for John_Ivan
<weaksauce>
it will mess you up
<weaksauce>
and omitting parens on methods that don't have arguments is common. reads easier
<weaksauce>
but, adding parens when there are arguments is what should be done
michigan has joined #ruby
<John_Ivan>
fair
<John_Ivan>
weaksauce, right, well, so far, aside from some of the conventions, things look good.
<John_Ivan>
it's not python or js.
<John_Ivan>
:P
<weaksauce>
for i in [*1..10] { puts(i) }
<weaksauce>
doesn't create a new scope for i
<weaksauce>
i is equal to 10 now
<weaksauce>
vs [*1..10].each { |i| puts(i) }
<weaksauce>
i is undefined
<John_Ivan>
so `i` is left dangling around the scope, taking up namespace
<John_Ivan>
that's..... meh.
<weaksauce>
nah it will clobber too
<weaksauce>
so if you have say i = 42 it would be overwritten
<weaksauce>
at the end of the for loop
<John_Ivan>
makes sense.
TCZ has quit [Quit: Leaving]
<John_Ivan>
weaksauce, nice, there's also no need to artificially create accessors/mutators for each variable you add to your class
<weaksauce>
there's attr_accessor, attr_reader and attr_writer if you want to make the basic cases easily
<weaksauce>
rw, r and w
<weaksauce>
just pass in a symbol in your class
<John_Ivan>
yup. saw that in the book
<John_Ivan>
it's neat
_ht has quit [Remote host closed the connection]
<nakilon>
05:11:13 <John_Ivan> but I need this running on windows.
<nakilon>
the last time I had such demand I convinced them to make it a web app and use via browser
<John_Ivan>
my main data I process on is on NTFS drivers, used mainly by Windows.
<leftylink>
ugh I forget the flags every time... maybe I should just use awk
<leftylink>
pandabot: what's ruby flags
<pandabot>
rubyflags is: ruby -ple '$_.upcase!' < input.txt; ruby -nle 'BEGIN { i = c = 0 }; c += $_.size; puts "#{i += 1} #$_"; END { p c }' < input.txt
<nakilon>
use bash ctrl+R
<weaksauce>
or ... make an alias
<weaksauce>
also, what are you doing with that monstrosity
<leftylink>
at first I thought I wanted a sum, but I decided min/max were sufficient, and since min/max is all I want, I went with sort -n instead of Ruby
<leftylink>
a sum over all the lines provided on standard input
bit4bit has quit [Remote host closed the connection]
<leftylink>
okay so if I want the sum it's awk '{s+=$1} END {print s}'
<nakilon>
is BEGIN END a thing from awk?
<leftylink>
I guess that seems likely
geewiz has quit [Ping timeout: 250 seconds]
michigan has quit [Quit: Connection closed for inactivity]