havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.4.2, 2.3.5 & 2.2.8: https://www.ruby-lang.org || Paste >3 lines of text to: https://gist.github.com || Rails questions? Ask in: #RubyOnRails || Logs: https://irclog.whitequark.org/ruby || Books: https://goo.gl/wpGhoQ
SeepingN has joined #ruby
<RickHull> oh wait
<RickHull> sorry I misread, it looks like L6 does *not* define a block
<RickHull> it's easy to misread when your indentation is all over the place :)
<nginxxx> okay thanks
<RickHull> the `end` on L15 -- what block does that close?
<RickHull> gah!
<RickHull> L6 does define a block
<RickHull> i keep misreading your code
d10n-work has quit [Quit: Connection closed for inactivity]
enterprisey has quit [Remote host closed the connection]
<RickHull> everything between L6 and L15 should be at the same indent level, with 2 spaces of indent
rainbowz has joined #ruby
<weaksauce> why don't you pass it in on the command line too `addresses = ARGV[0]`
<RickHull> (unless an expression is split across multiple lines)
<RickHull> nginxxx: please make (most of) the suggested changes and paste again
<RickHull> even if it doesn't run or behave as expected
<RickHull> in a nutshell: address should be local, not global. assign address before printing it or using it in an expression. fix your indenting
<nginxxx> l6 defines a block it is not wrong... go look on ruby docs.
<RickHull> nginxxx: I appreciate the suggestion, but try to follow my lead here
<nginxxx> and ruby is not like python, its not important how many spaces
<RickHull> nginxxx: it is important if you want people to read your code
<weaksauce> it's important, full stop
<nginxxx> why shoud i drop l3
<nginxxx> for what?
<RickHull> what is the purpose of L3? what does it accomplish?
<nginxxx> Theres nothing wrong
<nginxxx> I want to write in irb the hostname to resolve
<nginxxx> not in code
<nginxxx> ...
rainbowz has left #ruby ["WeeChat 1.4"]
<RickHull> ok, fair enough, in irb L3 will display the value of $address
zautomata has quit [Ping timeout: 260 seconds]
<RickHull> but it would not have a value at that point
<RickHull> if we are to take your pasted code as written
alveric2 has joined #ruby
rfoust has joined #ruby
<RickHull> irb is for playing around -- it will evaluate and print each expression -- but you should not share your code in this form
d^sh has quit [Ping timeout: 260 seconds]
<RickHull> for others to read
nginxxx has quit [Quit: Page closed]
<RickHull> the code you are sharing is full of "noise" and not much signal
<weaksauce> anything over a few lines should be run from a file and not irb...
<RickHull> and it makes it difficult for others to understand
<weaksauce> (a well indented file at that)
<RickHull> and you may not get as much help as you would like
alveric1 has quit [Ping timeout: 248 seconds]
<weaksauce> also, when you run `ruby myscript" it guarantees that you are free from any other variables being set accidentally
<RickHull> yes -- I like to "play around" in irb to get an understanding of the variable types, methods, how to structure things
<RickHull> then I will commit that knowledge to a file
sepp2k has quit [Quit: Leaving.]
<RickHull> and I can execute that file repeatedly without restarting irb and re-pasting code
<RickHull> or typing it in over-and-over
postmodern has joined #ruby
<RickHull> make a small edit to the file, then execute again, etc
<RickHull> If I don't have a good understanding of types, methods, structure, then it is probably too early to commit a lot of code to a file, as later lines will depend on prior lines
<RickHull> and any misconceptions committed to prior lines will make a lot of the later lines incorrect in both concept and execution
d^sh has joined #ruby
milardovich has joined #ruby
<leitz> Any experienced Ruby coders want to give a high level "You need to work on ..." review? My goal is to focus learning on "This should be my next couple topics" instead of "you need to learn everything first." My best Ruby code is: https://github.com/LeamHall/CT_Character_Generator
* leitz just wrapped up this week's MongoDB class in one day.
<RickHull> leitz: I skimmed it the other day -- I am a minimalist, simplest-thing-that-could-possibly-work type
* leitz has a note pad ready.
<RickHull> i have a couple minimalist libs / projects -- e.g. https://github.com/rickhull/loremarkov
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RickHull> maybe poke around -- `git clone` or `gem install`
Psybur has joined #ruby
<RickHull> I think they are good examples of well structured, minimalist libs (gems)
jackjackdripper has quit [Quit: Leaving.]
mtkd has quit [Ping timeout: 240 seconds]
<leitz> Cloned both.
<RickHull> if they make 100% sense, great!
mtkd has joined #ruby
<RickHull> i'm happy to answer any questions too :)
GotHyper has quit [Ping timeout: 255 seconds]
<RickHull> a good start after `git clone` is `rake -T`
<leitz> Of course, most meetings negate the need for loremarkov. :)
<leitz> simplecov in your .gitignore?
<leitz> Should flog, flay, and roodi be unavailable?
orbyt_ has joined #ruby
Psybur has quit [Ping timeout: 248 seconds]
<leitz> Ah, you're setting up for seattlerb tests that I haven't installed gems for.
<leitz> Gimme a sec.
hinbody has quit [Quit: leaving]
zautomata has joined #ruby
troys is now known as troys_
<leitz> RickHull, fair to say your first suggestion would be shorter and less complex methods?
<leitz> Career.rb/muster_out is only 40 some lines. :)
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RickHull> leitz: yep, sorry, was afk for a bit
<RickHull> leitz: and yeah, it's nice when the Rakefile still works even if all the dev stuff isn't there
<RickHull> so those are just informative messages that some dev dependencies aren't installed so the rake tasks aren't available
<RickHull> shorter and less complex methods, definitely a good thing. also methods that are testable or test-friendly
Technodrome has joined #ruby
jaequery has joined #ruby
<leitz> I added those gems and everything worked. roodi complained about an empty Rescue, that was it.
<leitz> I'm running Ruby 2.5.0-p1, by the way.
JBbanks has joined #ruby
<RickHull> for loremarkov -- notice the hard stuff is in class methods, where the return value is a function the method arguments
<weaksauce> leitz curious why ruby 1.8 in your ct_character_generator
<leitz> I need to figure out better uses of classes and how to make smaller methods without a bazillion of them running around.
<RickHull> i.e. `def self.foo`
oetjenj has joined #ruby
<leitz> weaksauce, I was initially running the OS based Ruby; 1.8.7.
<RickHull> and the instance methods are mostly about giving a nice user interface
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JBbanks has quit [Max SendQ exceeded]
<leitz> There was this original idea to use Ruby at work. That got shot down. Probably for the better.
JBbanks has joined #ruby
<RickHull> where the return value of a method is strictly (or nearly so) dependent on the input args, you have a very testable method
<leitz> RickHull, why class methods? I get the idea of them but don't really get them.
<RickHull> class methods vs instance method -- class methods have no access to instance variables -- aka ivars -- aka private state
<RickHull> File.open(filename) versus f = File.new(filename); f.open
<weaksauce> leitz the Dir or File classes are a good example of when to use class methods... you don't want to create an object to use it
<leitz> Ah. Cool.
<weaksauce> unless you need some inner state to use the function correctly.
* leitz scribbles...
pilne has joined #ruby
<RickHull> here's an example of someone else's lib that I refactored to use much less private state: https://github.com/rickhull/simplex/tree/modernize
<RickHull> it's easy for ruby newbies to try to write every piece of functionality as instance methods making heavy use of ivars
<RickHull> but this is very hard to test and make sense of
<RickHull> it's tempting to write methods that are basically just stored procedures that maybe take some args, read some ivar values, update other ivar values, and maybe have a significant return value
<RickHull> and there's nothing exactly "wrong" with this approach
<RickHull> with enough study and tracing, you can figure out what's really going on
<weaksauce> leitz fwiw it looks like muster_out is refactorable to be much shorter
<RickHull> i prefer a different structure and organization that makes the "dataflow" clear
<RickHull> args go in, return values come out
workmad3 has joined #ruby
<weaksauce> also, eloquent ruby is one of the best programming books i have read hands down
<leitz> weaksauce, I agree. Am reading Booch's "OO Analysis and Design" and getting a better understanding of how to break things down.
JBbanks has quit [Ping timeout: 240 seconds]
<leitz> "Eloquent Ruby" is about eight inches from my clipboard where I make notes when not typing.
<weaksauce> leitz is there a specific reason you are using Hash.new(0) instead of just {}... do you need the default value being set for missing keys?
milardov_ has joined #ruby
<leitz> weaksauce, there was something I hit a while back and the (0) solved the problem. Not sure what. However, I prefer setting defaults.
<leitz> Came from another book I read. :)
<RickHull> that hash default is a big pitfall IIRC -- rarely useful imho
* leitz has lots of books.
<leitz> Yeah, I'm trying to remember what the issue was that it solved.
<weaksauce> usually it's for the case where you have a homogenized set of values that all start at 0 say the weights of a graph edge or something like that but yeah I agree that it's something that I don't use very often
<RickHull> actually, with integers it should be ok
<RickHull> but any mutable value will probably not do what you want
<weaksauce> leitz i would say that it was probably something along the lines of my_hash['missingkey'] += 1
<weaksauce> that's what usually fails me
<RickHull> >> h = Hash.new('str'); h[:bar] << 'baz'; h[:foo]
<ruby[bot]> RickHull: # => "strbaz" (https://eval.in/904775)
workmad3 has quit [Ping timeout: 268 seconds]
milardovich has quit [Ping timeout: 240 seconds]
<RickHull> there is a single default object -- not a new object at every unset key
<weaksauce> yeah that's bitten me in the ass before
<RickHull> for a new object, you want h = Hash.new { |h, k| h[k] = 'str' }
<RickHull> >> h = Hash.new { |h, k| h[k] = 'str' }; h[:bar] << 'baz'; h[:foo]
<ruby[bot]> RickHull: # => "str" (https://eval.in/904776)
<RickHull> if you don't want to mess with default values and do e.g. accumulation: h[:foo] ||= 0; h[:foo] += 1
ramortegui has quit [Quit: This computer has gone to sleep]
cdg has joined #ruby
mn3m has joined #ruby
<leitz> weaksauce, you're probably right on the 'missingkey' bit. My chat logs aren't clear on it.
<weaksauce> i tend to do that RickHull for most default values
<bougyman> the Hash.new(0) is used all over our code when the hash is comprised of counters.
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<leitz> RickHull, I'm not sure symbols were allow as hash keys in 1.8.7. Or maybe I wasn't aware of them.
<weaksauce> the special syntax wasn't there but they were allowed I believe
<weaksauce> >> h = {test: :this, out: :yeah}
<ruby[bot]> weaksauce: # => {:test=>:this, :out=>:yeah} (https://eval.in/904777)
drowze has quit [Ping timeout: 268 seconds]
<weaksauce> i take it back no they weren't allowed
<leitz> Yeah, well, they are on the long list of things I need to learn. :)
<weaksauce> oh nevermind i am dumb. they were.
cdg has quit [Ping timeout: 248 seconds]
ramfjord has quit [Ping timeout: 240 seconds]
<leitz> I think refactoring muster_out will be a fun challenge.
<weaksauce> it's a nice shorthand in newer rubies when the key is a symbol but you were allowed to do h = {:test => :this, :out => :yeah}
<leitz> There are lots of unique things to take care of in that process.
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jaruga has joined #ruby
jaruga has quit [Client Quit]
<weaksauce> you might want to use sample inside your benefits code
<weaksauce> >> (1..10).to_a.sample(3)
<ruby[bot]> weaksauce: # => [9, 3, 8] (https://eval.in/904781)
<weaksauce> >> (1..10).to_a.sample(1)
<ruby[bot]> weaksauce: # => [4] (https://eval.in/904782)
<RickHull> bougyman: I've been burned so many times by that form, I stopped using it. but it does indeed look good for numeric -- and frozen strings too I'd think
<bougyman> RickHull: how could you get burned by it for counters?
<RickHull> not with counters, well maybe an array of counters
<RickHull> i got burned by mutating
<bougyman> ah, understood.
<bougyman> Yes, only ints.
<bougyman> But for ints I do think it fits the use case perfectly.
<RickHull> almost certainly with arrays, probably hashes, maybe strings
<RickHull> yep -- that's what I was trying to say
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
<RickHull> i.e. thanks for pointing it out -- I had given up on it :)
<baweaver> >>module Enumerable;def count_by(&block)group_by(&block).transform_values(&:length);end;end;[1,1,2,3,4,5,5,5,6].count_by(&:itself)
<ruby[bot]> baweaver: # => undefined method `transform_values' for {1=>[1, 1], 2=>[2], 3=>[3], 4=>[4], 5=>[5, 5, 5], 6=>[6]}:Ha ...check link for more (https://eval.in/904783)
<baweaver> boo
<baweaver> >>module Enumerable;def count_by(&block)group_by(&block).map{|k,v|[k,v.size]}.to_h;end;end;[1,1,2,3,4,5,5,5,6].count_by(&:itself)
<ruby[bot]> baweaver: # => {1=>2, 2=>1, 3=>1, 4=>1, 5=>3, 6=>1} (https://eval.in/904784)
kryptoz has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
orbyt_ has joined #ruby
joelwallis has joined #ruby
dinfuehr has joined #ruby
Psybur has joined #ruby
mn3m has quit [Remote host closed the connection]
Psybur has quit [Ping timeout: 248 seconds]
<al2o3-cr> RickHull: i think `PACK_MAP.fetch_values(*DEFINITION.values).join` reads better :)
<RickHull> ooh, I haven't used fetch_values before
<RickHull> when did that show up?
marr has quit [Ping timeout: 252 seconds]
<al2o3-cr> 2.3 i think
<RickHull> what's the best way to write that in a 2.1 compatible way?
<al2o3-cr> leitz: if you ever find yourself use `to_i(16)` use `hex` instead :)
<al2o3-cr> RickHull: your way :P
<al2o3-cr> *using
<RickHull> ha -- not saying it has to be done that way. I like 2.0 compatibility, but I'm thinking about 2.2
<leitz> al203-cr, I'll have to look 'hex' up. Of course, now we're using extended hex; 0-9A-Z sans I and O.
milardovich has joined #ruby
<al2o3-cr> RickHull: all is good i think :)
<al2o3-cr> >> ["ff".to_i(16), "ff".hex]
<ruby[bot]> al2o3-cr: # => [255, 255] (https://eval.in/904785)
charliesome has joined #ruby
milardov_ has quit [Ping timeout: 248 seconds]
<al2o3-cr> cos i'm nice like that :p
ap4y has quit [Ping timeout: 260 seconds]
uZiel has joined #ruby
mim1k has joined #ruby
<RickHull> I like yours though
Guest70176 has joined #ruby
Barrt has quit [Ping timeout: 248 seconds]
mim1k has quit [Ping timeout: 240 seconds]
Barrt has joined #ruby
<al2o3-cr> interesting to say the least.
<al2o3-cr> bed time me thinks.
Guest70176 has quit [Ping timeout: 248 seconds]
emilford has quit [Quit: Lost terminal]
<RickHull> good night :)
fyrril2 has joined #ruby
<leitz> Night! I'm late to bed myself but stuck on a refactor induce test failure. :(
kryptoz has quit [Remote host closed the connection]
<al2o3-cr> nite ya'll :)
<al2o3-cr> o/
jameser has joined #ruby
bmurt has joined #ruby
fyrril has quit [Ping timeout: 240 seconds]
d^sh_ has joined #ruby
jameser has quit [Read error: Connection reset by peer]
d^sh has quit [Ping timeout: 240 seconds]
Barrt has quit [Ping timeout: 248 seconds]
jameser has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
Barrt has joined #ruby
jaequery has joined #ruby
jameser has quit [Read error: Connection reset by peer]
jameser has joined #ruby
<leitz> Well, that was fun. Refactored off 11 lines of muster_out and found a repeated bug in several tests.
jaequery has quit [Client Quit]
jaequery has joined #ruby
<weaksauce> leitz yeah that will do it
Barrt has quit [Ping timeout: 240 seconds]
Psybur has joined #ruby
hinbody has joined #ruby
jaequery has quit [Ping timeout: 248 seconds]
Barrt has joined #ruby
<leitz> Okay, time to totter off.
leitz has quit [Quit: Nappy time]
Zamyatin has joined #ruby
Psybur has quit [Ping timeout: 248 seconds]
Zamyatin has quit [Client Quit]
milardov_ has joined #ruby
milardov_ has quit [Remote host closed the connection]
milardov_ has joined #ruby
joelwallis has quit []
drewmcmillan has joined #ruby
cschneid_ has joined #ruby
milardovich has quit [Ping timeout: 248 seconds]
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
milardov_ has quit [Ping timeout: 240 seconds]
pilne has quit [Quit: Quitting!]
zautomata has quit [Ping timeout: 268 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zautomata has joined #ruby
tenderlove has joined #ruby
hinbody has quit [Quit: leaving]
isene has quit [Quit: WeeChat 1.9]
elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has joined #ruby
kitsunenokenja has quit [Ping timeout: 258 seconds]
rfoust has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Cohedrin has joined #ruby
sucks has joined #ruby
sucks has quit [Remote host closed the connection]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gizmore|2 has joined #ruby
dhollinger has quit [Read error: Connection reset by peer]
motstgo has joined #ruby
workmad3 has joined #ruby
Guest70176 has joined #ruby
gizmore has quit [Ping timeout: 250 seconds]
cdg has joined #ruby
govg has quit [Ping timeout: 240 seconds]
nofxx__ has joined #ruby
motstgo_ has quit [Ping timeout: 248 seconds]
nofxx_ has quit [Read error: Connection reset by peer]
workmad3 has quit [Ping timeout: 240 seconds]
cdg has quit [Ping timeout: 258 seconds]
oetjenj has quit [Remote host closed the connection]
Guest70176 has quit [Ping timeout: 260 seconds]
oetjenj has joined #ruby
elcontrastador has joined #ruby
enterprisey has joined #ruby
shoogz has joined #ruby
shoogz has quit [Max SendQ exceeded]
shoogz has joined #ruby
shoogz has quit [Max SendQ exceeded]
shoogz has joined #ruby
shoogz has quit [Max SendQ exceeded]
shoogz has joined #ruby
shoogz has quit [Max SendQ exceeded]
shoogz has joined #ruby
shoogz has joined #ruby
oetjenj has quit [Client Quit]
cdg has joined #ruby
oetjenj has joined #ruby
faces has quit [Ping timeout: 248 seconds]
Barrt has quit [Ping timeout: 248 seconds]
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
kryptoz has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
GodFather has quit [Ping timeout: 248 seconds]
Cohedrin has quit [Read error: Connection reset by peer]
enko has joined #ruby
Cohedrin has joined #ruby
elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dviola has quit [Quit: WeeChat 1.9.1]
mson has quit [Quit: Connection closed for inactivity]
guardianx has joined #ruby
jackjackdripper has joined #ruby
jackjackdripper has quit [Client Quit]
jackjackdripper has joined #ruby
Psybur has joined #ruby
Barrt has joined #ruby
tcopeland has joined #ruby
uZiel has joined #ruby
Psybur has quit [Ping timeout: 248 seconds]
epochwolf has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
epochwolf has joined #ruby
Guest90_ has joined #ruby
mjolnird has quit [Quit: Leaving]
milardovich has joined #ruby
Cohedrin has quit [Read error: Connection reset by peer]
Cohedrin has joined #ruby
Barrt has quit [Ping timeout: 260 seconds]
fyrril2 has quit [Quit: Leaving]
mim1k has joined #ruby
fyrril has joined #ruby
Barrt has joined #ruby
jtdoncas has joined #ruby
mim1k has quit [Ping timeout: 248 seconds]
jameser has quit [Read error: Connection reset by peer]
kryptoz has quit [Remote host closed the connection]
jameser has joined #ruby
jtdoncas has quit [Ping timeout: 240 seconds]
ASFT has joined #ruby
Barrt has quit [Ping timeout: 248 seconds]
zanoni has quit [Ping timeout: 240 seconds]
deadpoet has joined #ruby
kryptoz has joined #ruby
deadpoet has quit [Quit: leaving]
bwilson has joined #ruby
shortdudey123 has quit [Ping timeout: 248 seconds]
shortdudey123 has joined #ruby
Psybur has joined #ruby
plexigras has quit [Ping timeout: 268 seconds]
Barrt has joined #ruby
ramortegui has joined #ruby
milardov_ has joined #ruby
Psybur has quit [Ping timeout: 240 seconds]
kies has joined #ruby
milardovich has quit [Ping timeout: 248 seconds]
maum has joined #ruby
Guest70176 has joined #ruby
leeice1 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest70176 has quit [Ping timeout: 240 seconds]
mson has joined #ruby
kryptoz has quit [Remote host closed the connection]
leeice1 has left #ruby [#ruby]
ASFT has quit [Ping timeout: 260 seconds]
Rouge has quit [Ping timeout: 248 seconds]
orbyt_ has joined #ruby
dhollinger has joined #ruby
govg has joined #ruby
ramortegui has quit [Quit: This computer has gone to sleep]
gix has joined #ruby
workmad3 has joined #ruby
gix- has quit [Ping timeout: 248 seconds]
kryptoz has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
nofxx__ has quit [Quit: Leaving]
nofxx has joined #ruby
Barrt has quit [Ping timeout: 248 seconds]
Barrt has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
milardovich has joined #ruby
jamesaxl has joined #ruby
nicesignal has quit [Remote host closed the connection]
nicesignal has joined #ruby
guardianx has quit [Remote host closed the connection]
milardov_ has quit [Ping timeout: 240 seconds]
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has quit [Remote host closed the connection]
stan has quit [Ping timeout: 248 seconds]
Psybur has joined #ruby
seggy has joined #ruby
seggy has quit [Client Quit]
Barrt has quit [Ping timeout: 248 seconds]
seggy has joined #ruby
Barrt has joined #ruby
Psybur has quit [Ping timeout: 240 seconds]
iamarun has joined #ruby
astrobunny has joined #ruby
k3rn31_ has joined #ruby
helpa has quit [Remote host closed the connection]
helpa-bot has joined #ruby
Guest70176 has joined #ruby
helpa-bot has quit [Remote host closed the connection]
mjolnird has joined #ruby
helpa has joined #ruby
mjolnird has quit [Remote host closed the connection]
cdg has quit [Remote host closed the connection]
milardovich has quit [Remote host closed the connection]
Guest70176 has quit [Ping timeout: 248 seconds]
mjolnird has joined #ruby
exhiled has joined #ruby
rabajaj has joined #ruby
Guest17927 has joined #ruby
hays has joined #ruby
hays has joined #ruby
hays has quit [Changing host]
minimalism has joined #ruby
<hays> i have ruby on a windows machine (rubyinstaller) and when I did gem update --system and gem update, I got an error with did_you_mean gem, saying it needed 2.4.0
<hays> is it safe to just uninstall this gem?
<havenwood> hays: Yes, it's fine to uninstall it. What version are you on?
<hays> 2.3.2 i think it was
mim1k has joined #ruby
<hays> 2.3.1p112
<hays> its kinda weird, it seems to know that it can't upgrade it.. yet it tries and fails anyway
<hays> seems like gem update should just leave it at the last version supporting my version of ruby
michael1 has joined #ruby
Barrt has quit [Ping timeout: 248 seconds]
mim1k has quit [Ping timeout: 248 seconds]
<havenwood> hays: that's typically what happens
Barrt has joined #ruby
<hays> i guess gem update is a bit risky then
<havenwood> ERROR: Error installing did_you_mean:
<havenwood> did_you_mean requires Ruby version >= 2.4.0.
<havenwood> hays: ^ that's the error you get if you try to update did_you_mean on Ruby 2.3
<hays> yep
<havenwood> hays: The version of did_you_mean that you have is the latest version that works with Ruby 2.3.
<havenwood> You don't need to uninstall it just because it can't be updated, but you're free to if you want.
<hays> is there a way to freeze the version of that gem so gem update ignores it
enterprisey has quit [Remote host closed the connection]
zautomata has quit [Quit: WeeChat 1.7]
ramfjord has joined #ruby
st4l1n has joined #ruby
<havenwood> hays: Nope
<havenwood> hays: FWIW (little) you can silence warnings: gem update 2>/dev/null
<hays> you done the rubyinstaller 2.4.2 by any chance? I am getting an error on installing MSYS2+MINGW toolchain
<st4l1n> Hey, I'm newish to ruby and wishing to become an absolute expert over the next few years. I've heard a great way to go about this is to request a mentor. Can anyone suggest places for this or other methodoloiges/books for becoming an expert in ruby
<apeiros_> st4l1n: please change your nick
apeiros_ is now known as apeiros
<havenwood> hays: I think it's confusing that did_you_mean gets listed as an updated gem when it doesn't update. And I agree the warning is odd. I'm not sure on the optimal fix but it seems worth looking at.
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
st4l1n is now known as marcosstanos
<apeiros> thanks
ramfjord has quit [Ping timeout: 248 seconds]
<marcosstanos> all good
<marcosstanos> As for my question..
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros> in the topic, there's a book list. there are a couple of free online training places like exercise.io
Guest70176 has joined #ruby
<apeiros> personally I prefer the way of "just get a project and start working". you can always ask here about advices on your code.
<havenwood> marcosstanos: RubyConf has an official guides and scholars program. That's a great place to find a mentor. You might consider applying for an opportunity scholarship next year.
cdg has joined #ruby
<havenwood> marcosstanos: Local meet-ups are a good place to find mentorship. Or if you can find a workplace with mentors that's ideal.
<marcosstanos> What level should I be at to get the most value out of such a programme?
<havenwood> marcosstanos: Most of the scholars this year had about a year experience. Some had none. One had four years.
<baweaver> Also see the book list: https://goo.gl/wpGhoQ
cschneid_ has quit [Remote host closed the connection]
<havenwood> marcosstanos: Here's a site where you can pay for in-depth mentorship: https://www.bloc.io/mentors
<havenwood> marcosstanos: You can certainly find an unpaid mentor, it just takes more searching.
Guest70176 has quit [Ping timeout: 248 seconds]
cdg has quit [Ping timeout: 240 seconds]
<havenwood> And feel free to ask lots of questions here!
<hays> its weird to be running pacman on a win7 machine. haha
<hays> someone loves arch
<marcosstanos> Fantastic, thanks for the resources
<hays> havenwood: i agree its weird. but i've decided to focus forward and just put 2.4 on here and fix the bugs that happen if any
Psybur has joined #ruby
<hays> its a lab anyway
<Nilium> Cue everyone trying to hang hays.
<hays> lol could happen. but rolling back to 2.3 on a single laptop is also not that bad
<hays> and im the one that owns this code so im really just hurting myself if anything happens
<baweaver> Nilium: Now why would we do that?
<Nilium> Well, I meant the lab users.
Cohedrin has joined #ruby
<Nilium> #ruby is very friendly.
<baweaver> Ah
<Nilium> Which is actually part of the reason I still hang around here, compared to most other language channels.
i8igmac has joined #ruby
SeepingN has joined #ruby
<baweaver> We try and be at least :)
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<hays> ruby community is great. language is great too. I mean I also like Python because its hard to beat numpy+scipy+pandas+matplotlib
* Nilium likes Erlang.
Psybur has quit [Ping timeout: 260 seconds]
<Nilium> Insert cricket sounds here.
<hays> haha i remember a guy in college liking erlang. way before FP was cool
<baweaver> The cool kids use Elixir now
<hays> i got into Scheme myself
<baweaver> Just ask Radar, he's even writing a book for it
* Nilium still doesn't really like Elixir's syntax.
<baweaver> Radar: was it still "a" or "multiple" now?
<hays> all the real FP seems to be done in EMCAScript these days. who'd have ever thought that would happen
<Nilium> Let's assume multiple at some point.
<baweaver> I even make a crack about Scheme in my book: Where'd we get the car? I think from something called LISP, such a little Schemer it is. Jokes aside, car is just an example object for us to play with for now.
<marcosstanos> wow, Bloc.io is incredibly expensize. Are there any cheaper mentor programmes?
<hays> haha im defragging this hard drive
<hays> windows. funny
<baweaver> Haven't heard of a defrag in years
<hays> this laptop runs win7 because there's some old hardware it needs to connect to
milardovich has joined #ruby
Barrt has quit [Ping timeout: 248 seconds]
oleo has quit [Quit: Leaving]
dionysus69 has joined #ruby
biberu has joined #ruby
Technodrome has joined #ruby
BioSpider has joined #ruby
ta_ has quit [Remote host closed the connection]
michael1 has quit [Ping timeout: 248 seconds]
sylario has quit [Quit: Connection closed for inactivity]
Barrt has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
workmad3 has joined #ruby
<baweaver> Oh hey, RickHull is famous now: https://twitter.com/yukihiro_matz/status/933225728518139904
<havenwood> RickHull: congrats!
<RickHull> ha, thanks. the little germ of the idea is a total hack
<RickHull> "let's take the example of 'hello world' as a C string, and see how much .rb we can shove in there"
<RickHull> but I figured out git submodules and how to get stuff building automatically with rake tasks. like just this evening
workmad3 has quit [Ping timeout: 260 seconds]
<RickHull> it might actually be reasonable once it does the same thing with bytecode
arquebus has joined #ruby
charliesome has joined #ruby
arquebus has quit [Client Quit]
oetjenj has joined #ruby
lexruee has quit [Ping timeout: 268 seconds]
lexruee has joined #ruby
milardov_ has joined #ruby
mjolnird has quit [Remote host closed the connection]
peter1 has joined #ruby
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
peter1 is now known as pecan
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
snickers has joined #ruby
milardovich has quit [Ping timeout: 248 seconds]
Psybur has joined #ruby
Mortomes|Work has joined #ruby
conta has joined #ruby
hays has quit [Remote host closed the connection]
Psybur has quit [Ping timeout: 264 seconds]
andikr has joined #ruby
kickr has quit [Read error: Connection reset by peer]
kickr_ has joined #ruby
kickr_ has quit [Read error: Connection reset by peer]
kickr_ has joined #ruby
kickr_ has quit [Read error: Connection reset by peer]
kickr has joined #ruby
Flonk has quit [Remote host closed the connection]
Flonk has joined #ruby
Guest70176 has joined #ruby
Barrt has quit [Ping timeout: 260 seconds]
snickers has quit [Quit: Textual IRC Client: www.textualapp.com]
Barrt has joined #ruby
hightower2 has joined #ruby
DTZUZU has quit [Ping timeout: 240 seconds]
gone_haywire has joined #ruby
mim1k has joined #ruby
mjolnird has joined #ruby
Mortomes|Work has quit [Ping timeout: 260 seconds]
milardovich has joined #ruby
mim1k has quit [Ping timeout: 255 seconds]
i8igmac has quit [Remote host closed the connection]
Mortomes|Work has joined #ruby
milardov_ has quit [Ping timeout: 268 seconds]
ta_ has joined #ruby
Barrt has quit [Ping timeout: 252 seconds]
aufi has joined #ruby
ramfjord has joined #ruby
TomyWork has joined #ruby
Guest17927 has quit [Quit: WeeChat 0.4.2]
mson has quit [Quit: Connection closed for inactivity]
ramfjord has quit [Ping timeout: 240 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Mortomes|Work has quit [Ping timeout: 260 seconds]
kapil___ has joined #ruby
DoubleMalt has joined #ruby
Dimik has quit [Ping timeout: 255 seconds]
cschneid_ has joined #ruby
<waveprop> hays which scheme
Barrt has joined #ruby
reber has joined #ruby
cschneid_ has quit [Ping timeout: 246 seconds]
Psybur has joined #ruby
ta__ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
guille-moe has joined #ruby
Psybur has quit [Ping timeout: 268 seconds]
claudiuinberlin has joined #ruby
faces has joined #ruby
mark_66 has joined #ruby
Guest70176 has quit [Ping timeout: 268 seconds]
Technodrome has joined #ruby
milardov_ has joined #ruby
radanisk_ has joined #ruby
InfinityFye has joined #ruby
milardovich has quit [Ping timeout: 258 seconds]
RickHull has quit [Ping timeout: 260 seconds]
govg has quit [Quit: all]
konsolebox_ has quit [Ping timeout: 240 seconds]
marcosstanos has quit [Quit: leaving]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<kapil___> I have two list. In first function I iterate first list and print some code. How should I inject respective values from second list in it?
Technodrome has joined #ruby
tomphp has joined #ruby
konsolebox has joined #ruby
mim1k has joined #ruby
guille-moe has quit [Ping timeout: 255 seconds]
ur5us has joined #ruby
mim1k has quit [Ping timeout: 240 seconds]
workmad3 has joined #ruby
<ruby[bot]> Bish: # => [["a", 0], ["b", 1], ["c", 2], ["d", 3], ["e", 4], ["f", 5], ["g", 6], ["h", 7], ["i", 8], ["j", 9], ...check link for more (https://eval.in/905066)
<Bish> you can zip 2 arrays of same size, and it will be zipped, like a zipper.
<Bish> i just learnd that trick :p
<Bish> >> ('a'..'z').zip(0..26).to_a
<Bish> kapil___:
jus_ has joined #ruby
guille-moe has joined #ruby
<Bish> is that what you want?
xall has joined #ruby
jus_ has left #ruby [#ruby]
silvermine has joined #ruby
<Bish> kapil___: otherwise you could do some .each_with_index shenanigans
<Bish> >> ('a'..'z').each_with_index.map { |char,idx| "#{char}#{idx}" }
<ruby[bot]> Bish: # => ["a0", "b1", "c2", "d3", "e4", "f5", "g6", "h7", "i8", "j9", "k10", "l11", "m12", "n13", "o14", "p15 ...check link for more (https://eval.in/905068)
Burgestrand has joined #ruby
workmad3 has quit [Ping timeout: 252 seconds]
ur5us has quit [Read error: Connection reset by peer]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
ur5us has joined #ruby
Guest90_ has quit [Quit: Textual IRC Client: www.textualapp.com]
radanisk_ has quit []
<Bish> asm>> ('a'..'z').each_with_index.map { |char,idx| "#{char}#{idx}" }
<ruby[bot]> Bish: I have disassembled your code, the result is at https://eval.in/905085
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maum has quit [Remote host closed the connection]
cdg has joined #ruby
cdg_ has joined #ruby
mrig has joined #ruby
Rouge has joined #ruby
FastJack has quit [Read error: Connection reset by peer]
<kapil___> I also want remaining items in the end
FastJack has joined #ruby
milardovich has joined #ruby
<Bish> kapil___: can you give a short example, i have no clue what remaining items in the end mean
luminor has joined #ruby
<Bish> are your 2 arrays not of same size?
cdg has quit [Ping timeout: 250 seconds]
<kapil___> ('a'..'z').zip(0..40).to_a
cdg_ has quit [Read error: Connection reset by peer]
bronson has quit [Read error: Connection reset by peer]
<Bish> >> (1..5).zip(1..3).map(&:itself)
<ruby[bot]> Bish: # => [[1, 1], [2, 2], [3, 3], [4, nil], [5, nil]] (https://eval.in/905088)
cdg has joined #ruby
Psybur has joined #ruby
<Bish> like this?
Guest70176 has joined #ruby
bronson has joined #ruby
<Bish> >> (1..5).zip(1..3).map(&:compact)
<ruby[bot]> Bish: # => [[1, 1], [2, 2], [3, 3], [4], [5]] (https://eval.in/905089)
<Bish> or like this?
<Bish> >> (1..5).zip(1..3).map(&:compact).flatten
<ruby[bot]> Bish: # => [1, 1, 2, 2, 3, 3, 4, 5] (https://eval.in/905090)
<Bish> or this?
<mrig> Hello :); I am not a regular ruby user but I do use it for jekyll on my static github pages site, I was wondering if any one could help me with a little issue; When I set the site up I found a Gemfile.lock file provided by Github to insure the correct rubygem versions for their servers; I don't seem to be able tofind a more recent version of this file.
<kapil___> Second list is bigger size
<Bish> >> (1..3).zip(1..5).map(&:compact).flatten
<ruby[bot]> Bish: # => [1, 1, 2, 2, 3, 3] (https://eval.in/905091)
<kapil___> Thanks
<Bish> no, that doesn't seem to work
<kapil___> Oh
milardov_ has quit [Ping timeout: 268 seconds]
<kapil___> Can you make a function for it?
cdg has quit [Ping timeout: 250 seconds]
<Bish> >> well, it's just a question of order
<ruby[bot]> Bish: # => /tmp/execpad-17d54b6672df/source-17d54b6672df:2: syntax error, unexpected tSTRING_BEG, expecting key ...check link for more (https://eval.in/905095)
<kapil___> mrig: run 'bundle update' to update gems
Psybur has quit [Ping timeout: 258 seconds]
<kapil___> What (&:compact) means?
<Bish> >> (1..5).zip(1..3).map(&:compact).map(&:reverse).flatten
<ruby[bot]> Bish: # => [1, 1, 2, 2, 3, 3, 4, 5] (https://eval.in/905101)
mim1k has joined #ruby
<Bish> this could be what you want, i guess
<Bish> but easier to understand might be
<Bish> >> first = [1,2,3,4,5];second = [1,2,3]; first.each_with_index { |e,idx| [e,second[idx]].compact }.flatten
<ruby[bot]> Bish: # => [1, 2, 3, 4, 5] (https://eval.in/905111)
<Bish> eh.
<kapil___> Thanks Bish
<Bish> >> first = [1,2,3,4,5];second = [1,2,3]; first.each_with_index.map { |e,idx| [e,second[idx]].compact }.flatten
<ruby[bot]> Bish: # => [1, 1, 2, 2, 3, 3, 4, 5] (https://eval.in/905115)
<Bish> this !
mim1k has quit [Disconnected by services]
mim1k_ has joined #ruby
luminor has quit []
<kapil___> Yes that's I want
luminor has joined #ruby
luminor_ has joined #ruby
luminor has quit [Ping timeout: 248 seconds]
mim1k_ is now known as mim1k
sylario has joined #ruby
Beams has joined #ruby
cek has joined #ruby
<mrig> kapil___, ah, I have just changed distro and have not looked at the ruby instillation as yet; This is required as I have recieved a complaint from github about one of the pacages linked in the gemfile.lock listing, all that is required is the current list from github I think, was wondering if this is still in use, and as such if I could get a pointer to it from here, could be that it is no longer a thing :)
<mrig> heh, sorry spell check not working yet on weechat either :/
DoubleMalt has quit [Ping timeout: 240 seconds]
<cek> ask weechat about tiananmen square , you'll get wonderful results
<cek> ok, my question: how do you get an intersection of arrays a and b so that you get full b in case a is empty? can't think a solution without a conditional
<dminuoso> cek: &ri Array #-
<dminuoso> &ri Array #- cek
<mrig> cek huh?
xall has quit [Read error: Connection reset by peer]
<cek> a & b or a , but so that it actually works
astrobunny has quit [Remote host closed the connection]
xall has joined #ruby
jaruga has joined #ruby
postmodern has quit [Ping timeout: 250 seconds]
_xall has joined #ruby
_xall has quit [Client Quit]
DoubleMalt has joined #ruby
enterprisey has joined #ruby
luminor_ has quit []
milardov_ has joined #ruby
ur5us has quit [Remote host closed the connection]
xall has quit [Ping timeout: 246 seconds]
cschneid_ has joined #ruby
milardovich has quit [Ping timeout: 250 seconds]
cschneid_ has quit [Remote host closed the connection]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ramfjord has joined #ruby
cdg has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
cdg has quit [Ping timeout: 258 seconds]
DoubleMalt has quit [Ping timeout: 240 seconds]
ShekharReddy has quit [Quit: Connection closed for inactivity]
silvermine has quit [Ping timeout: 240 seconds]
<dminuoso> cek: Whats wrong with a conditional?
Psybur has joined #ruby
Serpent7776 has joined #ruby
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Psybur has quit [Ping timeout: 250 seconds]
gone_haywire has quit [Remote host closed the connection]
gone_haywire has joined #ruby
uZiel has quit [Remote host closed the connection]
uZiel has joined #ruby
tvw has joined #ruby
ldnunes has joined #ruby
jenrzzz has joined #ruby
mrig has quit [Remote host closed the connection]
workmad3 has joined #ruby
mrig has joined #ruby
GodFather has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ccooke has quit [Quit: Lost terminal]
ccooke has joined #ruby
milardovich has joined #ruby
milardov_ has quit [Ping timeout: 260 seconds]
xall has joined #ruby
xall has quit [Client Quit]
mrig has quit [Quit: o/]
s2013 has joined #ruby
ferr has joined #ruby
ferr has left #ruby [#ruby]
SirOliver has joined #ruby
ShekharReddy has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ohcibi has quit [Remote host closed the connection]
ohcibi has joined #ruby
stamina has joined #ruby
kyle has joined #ruby
kyle is now known as Guest90927
Psybur has joined #ruby
purpleunicorn has joined #ruby
rikkipitt has joined #ruby
hfp_work has quit [Quit: bye]
yeticry_ has joined #ruby
SirOliver has left #ruby ["Ave"]
lexruee has quit [Ping timeout: 250 seconds]
hfp_work has joined #ruby
lexruee has joined #ruby
Guest70176 has quit [Ping timeout: 268 seconds]
yeticry has quit [Ping timeout: 240 seconds]
Psybur has quit [Ping timeout: 260 seconds]
milardov_ has joined #ruby
Guest70176 has joined #ruby
morfin has joined #ruby
morfin has left #ruby [#ruby]
milardovich has quit [Ping timeout: 240 seconds]
Mortomes|Work has joined #ruby
Technodrome has joined #ruby
nobitanobi has joined #ruby
zanoni has joined #ruby
marr has joined #ruby
_hs366 has quit [Quit: Leaving]
rikkipitt has quit [Ping timeout: 260 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
silvermine has joined #ruby
tomphp has joined #ruby
tomphp has quit [Client Quit]
iamarun has quit [Remote host closed the connection]
benjen has quit [Ping timeout: 240 seconds]
purpleunicorn has quit [Ping timeout: 268 seconds]
zautomata has joined #ruby
ramfjord has joined #ruby
tacoboy has joined #ruby
milardovich has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
cek has quit [Quit: Connection closed for inactivity]
milardov_ has quit [Ping timeout: 250 seconds]
lupine has quit [Remote host closed the connection]
lupine has joined #ruby
gizmore|2 is now known as gizmore
<Guest90927> does anyone have an idea why this doesn't work? https://gist.github.com/sideshowbandana/db1ff1791a6b932be8b3f422037a5561
<Guest90927> the defined function fails with a no method error because $1 isn't set... however the call to gsub outside the function works just fine
<tobiasvl> Guest90927: shouldn't the regex be /\[([A-Z]*[ A-Z_0-9]*)\]
Psybur has joined #ruby
<tobiasvl> note the [A-Z]*
<tobiasvl> otherwise you'll just match one letter between A-Z followed by any number of groups of space or alphanumerals
<Guest90927> ah that could be it... but how does the second gsub succeed?
<tobiasvl> I also don't know if the space should be inside those brackets, but you know what you want to match better than me
cdg has joined #ruby
<Guest90927> added a comment on the result that I get in IRB
zenspider has joined #ruby
<Guest90927> it's almost as if I loose the gsub context when calling from within a function
Mortomes|Work has quit [Ping timeout: 260 seconds]
im0nde has joined #ruby
lupine has quit [Ping timeout: 255 seconds]
char_var[buffer] has quit [Ping timeout: 248 seconds]
benjen has joined #ruby
tacoboy has quit [Ping timeout: 240 seconds]
tacoboy has joined #ruby
Psybur has quit [Ping timeout: 248 seconds]
cdg has quit [Ping timeout: 255 seconds]
<Burgestrand> Guest90927 if you want to have some more fun, try swapping the order of gsub/doit
<matthewd> Guest90927: $1 looks like a global, but is actually a specially-scoped local.. tbh I'm actually not sure whether that's relevant in this case
<Guest90927> ya... that gets it to work...
<Guest90927> I think because gusb stores the global var and doesn't clear it after?
Guest90927 is now known as kyle
<kyle> I've also tried using the '\1' syntax
<kyle> same result
kyle is now known as Guest7623
zenspider has quit [Quit: bye]
<matthewd> Yeah, using different strings should confirm that
<matthewd> Use s[1]
<Burgestrand> kyle__ $1 uses $~, and $~ is not really global (it doesn't leak past the current thread if I remember correctly), it's the last match in the current *scope*
<Burgestrand> Oh darn wrong kyle.
<Burgestrand> Guest7623 ^
<Burgestrand> Guest7623 check this out for example https://eval.in/905381
<Guest7623> ah that would make sense as to why Regexp.last_match was also nil when I tried that
<Guest7623> good call matthewd, should have used the yielded match object
<Burgestrand> Guest7623 as matthewd mentioned, use the `match`-parameter that you're passed
lupine has joined #ruby
<Guest7623> heh... seems to only yield a string though
<Guest7623> not matchdata
guille-moe has quit [Ping timeout: 248 seconds]
k3rn31_ has quit [Quit: WeeChat 1.9.1]
k3rn31 has joined #ruby
dviola has joined #ruby
<Burgestrand> Ah yeah, you're right, gsub yields a string :(
<matthewd> Oh, it must detect the arity
<matthewd> Add another parameter to your block
silvermine has quit [Quit: WeeChat 2.0-dev]
uZiel has quit [Ping timeout: 248 seconds]
<Guest7623> the second argument ends up being nil when I have 2 params
<Guest7623> I'm stumped
<Guest7623> I swear it has something to do with the binding
hightower2 has quit [Ping timeout: 240 seconds]
kickr has quit [Read error: Connection reset by peer]
kickr has joined #ruby
kickr has quit [Read error: Connection reset by peer]
kickr_ has joined #ruby
tacoboy has quit [Remote host closed the connection]
<Guest7623> ya... it definitely has something to do with where the proc is defined
tacoboy has joined #ruby
<Burgestrand> Yeah, because the proc inherits its scope
<Guest7623> would it be possible to modify the scope?
lupine has quit [Ping timeout: 258 seconds]
<Guest7623> updated the gist... defining the proc within the functions scope totally works
deadpoet has joined #ruby
deadpoet has quit [Client Quit]
InfinityFye has quit [Quit: Leaving]
DoubleMalt has joined #ruby
lupine has joined #ruby
milardov_ has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
tacoboy has quit [Remote host closed the connection]
milardovich has quit [Ping timeout: 240 seconds]
silvermine has joined #ruby
vondruch_ has joined #ruby
VladGh has quit [Remote host closed the connection]
Ninja0012 has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
vondruch_ is now known as vondruch
VladGh has joined #ruby
Technodrome has joined #ruby
vee__ has quit [Ping timeout: 258 seconds]
ramfjord has joined #ruby
Ninja0012 has left #ruby [#ruby]
ramfjord has quit [Ping timeout: 260 seconds]
dcluna_ has joined #ruby
milardov_ has quit [Remote host closed the connection]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
milardovich has joined #ruby
jameser has joined #ruby
mensvaga has quit [Quit: Leaving.]
vee__ has joined #ruby
Burgestrand has quit [Quit: Closing time!]
rabajaj has quit [Remote host closed the connection]
tacoboy has joined #ruby
Psybur has joined #ruby
im0nde has quit [Ping timeout: 255 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
synthroid has joined #ruby
kryptoz has quit [Remote host closed the connection]
Psybur has quit [Ping timeout: 240 seconds]
kryptoz has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gone_haywire has quit [Remote host closed the connection]
gone_haywire has joined #ruby
Axy has quit [Ping timeout: 240 seconds]
nadir has joined #ruby
milardov_ has joined #ruby
andikr has quit [Remote host closed the connection]
Guest7623 has quit [Ping timeout: 248 seconds]
kryptoz has quit [Remote host closed the connection]
milardovich has quit [Ping timeout: 248 seconds]
drowze has joined #ruby
gheegh has quit [Quit: Textual IRC Client: www.textualapp.com]
Guest7623 has joined #ruby
truenito has joined #ruby
GodFather has quit [Ping timeout: 248 seconds]
uZiel has joined #ruby
im0nde has joined #ruby
mtkd has quit [Read error: Connection reset by peer]
^mtkd has joined #ruby
sentor``` has joined #ruby
BioSpider has quit [Ping timeout: 240 seconds]
deepredsky has joined #ruby
sentor`` has quit [Ping timeout: 248 seconds]
apparition has joined #ruby
im0nde_ has joined #ruby
rfoust has joined #ruby
im0nde__ has joined #ruby
im0nde has quit [Ping timeout: 248 seconds]
im0nde__ is now known as im0nde
Guest7623 has quit [Ping timeout: 248 seconds]
sentor``` has quit [Ping timeout: 248 seconds]
im0nde_ has quit [Ping timeout: 248 seconds]
Burgestrand has joined #ruby
dionysus69 has quit [Ping timeout: 248 seconds]
deepredsky has quit [Ping timeout: 268 seconds]
plexigras has joined #ruby
deepredsky has joined #ruby
Guest7623 has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
vondruch has joined #ruby
drowze has quit [Ping timeout: 268 seconds]
tomphp has joined #ruby
Guest7623 has quit [Ping timeout: 240 seconds]
vondruch has quit [Client Quit]
vondruch has joined #ruby
iamarun has joined #ruby
silvermine has quit [Ping timeout: 240 seconds]
vee__ has quit [Ping timeout: 240 seconds]
nowhere_man has quit [Remote host closed the connection]
tomphp_ has joined #ruby
tomphp has quit [Ping timeout: 248 seconds]
^mtkd has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
ramortegui has joined #ruby
nowhere_man has joined #ruby
tomphp_ has quit [Client Quit]
fredx has joined #ruby
Psybur has joined #ruby
uZiel has quit [Remote host closed the connection]
Guest70176 has quit [Ping timeout: 255 seconds]
uZiel has joined #ruby
iceden has quit [Ping timeout: 255 seconds]
guille-moe has joined #ruby
iceden has joined #ruby
drowze has joined #ruby
safetypin has joined #ruby
Psybur has quit [Ping timeout: 258 seconds]
vee__ has joined #ruby
shinnya has joined #ruby
InfinityFye has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
plexigras has quit [Quit: WeeChat 1.9.1]
TinkerTyper has quit [Ping timeout: 240 seconds]
vondruch_ has joined #ruby
vee__ has quit [Ping timeout: 260 seconds]
TinkerTyper has joined #ruby
br0d1n has joined #ruby
plexigras has joined #ruby
vondruch has quit [Ping timeout: 248 seconds]
vondruch_ is now known as vondruch
DLSteve has joined #ruby
ta__ has quit [Remote host closed the connection]
fredx has quit [Quit: Leaving]
Technodrome has joined #ruby
InfinityFye has quit [Quit: Leaving]
fredx has joined #ruby
LebedevRI has joined #ruby
Guest70176 has joined #ruby
polishdub has joined #ruby
kryptoz has joined #ruby
vee__ has joined #ruby
Burgestrand has quit [Quit: Closing time!]
larcara has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rouge has quit [Ping timeout: 240 seconds]
mcr1 has quit [Ping timeout: 246 seconds]
tomphp has joined #ruby
tomphp has quit [Client Quit]
silvermine has joined #ruby
tomphp has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
shinnya has quit [Ping timeout: 268 seconds]
tomphp has quit [Client Quit]
tomphp has joined #ruby
safetypin has quit [Quit: ZZZzzz…]
kryptoz has quit [Read error: Connection reset by peer]
kryptoz has joined #ruby
kryptoz has quit [Read error: Connection reset by peer]
uZiel has joined #ruby
mson has joined #ruby
kryptoz has joined #ruby
im0nde has quit [Quit: im0nde]
<Bish> can a proc reference itself?
<Bish> no, right?
iceden has quit [Ping timeout: 250 seconds]
<c-c> is it an object?
<Bish> i mean, can you in a block, get the reference of a block.
<Bish> >> [1,2,[3]].map { |a| case a;when Array;???;else a+1;end; }
<ruby[bot]> Bish: # => /tmp/execpad-317b2134579b/source-317b2134579b:2: syntax error, unexpected ';' ...check link for more (https://eval.in/905446)
<Bish> kinda like this
<Bish> or will i have to make a proc
<c-c> I don't understand
<Bish> i want to add 1 to every element in there, recusrively
<c-c> in your example. what you test in the case is some object from array, not a proc
<Bish> (i do not really want to do that, it's an example)
deepredsky has quit [Ping timeout: 248 seconds]
<Bish> the proc/block says " add 1"
<Bish> i want it to to it in every array element, if it's an array i want to go deeper
<c-c> I get the temptation to say "forget procs"
<Bish> hows that.. i need procs/methods for that.. if i don't have a reference then what am i calling
<c-c> Bish: so you want to do something for .each, recursively
<Bish> well, and conditionally.
<c-c> you are not calling? .each or .map is calling. Neither is recursive.
milardovich has joined #ruby
larcara has quit [Remote host closed the connection]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<c-c> Bish: I think what you want is 1) some method that handles_array_item 2) a walker that walks the array and calls handles_array_item when the item at hand is an array
<Bish> >> myproc = proc{|a| a.each { |x| case x; when Array; x.map(&:myproc); else x+1; end; } };myproc.call [1,2,3]
<ruby[bot]> Bish: # => [1, 2, 3] (https://eval.in/905458)
iceden has joined #ruby
<Bish> >> myproc = proc{|a| a.map { |x| case x; when Array; x.map(&:myproc); else x+1; end; } };myproc.call [1,2,3]
<ruby[bot]> Bish: # => [2, 3, 4] (https://eval.in/905459)
<Bish> i want exactly this
<Bish> but not to have myproc.
<Bish> >> myproc = proc{|a| a.each { |x| case x; when Array; x.map(&:myproc); else x+1; end; } };myproc.call [1,2,[3]]
<ruby[bot]> Bish: # => undefined method `myproc' for 3:Fixnum (NoMethodError) ...check link for more (https://eval.in/905460)
Rapture has joined #ruby
<c-c> Bish: in your handles_array_item, you can use block arg as: def h_a_item ( array, &blk )
tomphp has joined #ruby
<Bish> i know.. but i want it without having a reference
<c-c> then you can do stuff like &blk.call
milardov_ has quit [Ping timeout: 240 seconds]
<c-c> wow, I thought you asked if you can have a reference
<Bish> now, i want a reference from the blcok that i am in
<Bish> i know blcoks dont have references, etc.
<Bish> but would be super cool if you could
<c-c> hehe you could pass in the ref with &blk.call
tomphp has quit [Client Quit]
<c-c> Bish: do you know pry?
knight33 has joined #ruby
<c-c> get pry now
<c-c> then run pry from "when Array" and other cases. Test to see if you can refer to itself.
Psybur has joined #ruby
safetypin has joined #ruby
roshanavand has quit [Quit: Leaving]
oleo has joined #ruby
<Bish> i use pry
<Bish> i don't want the "self" refernece, i want the reference to the block.
<Bish> something like
<Bish> proc{ "i am a block and i can call myself with #{magic_block.call}"}.call
<Bish> being an endless loop of
<Bish> i am a block and i call myself with i am a block..
Psybur has quit [Ping timeout: 240 seconds]
<dminuoso> Yes you can.
<Bish> dminuoso: how how how
<dminuoso> F = -> () { F.() }
rippa has joined #ruby
<Bish> well that's a proc again
<dminuoso> Or without contants it works too.
<dminuoso> oh a block, no dice.
<Bish> :(
<dminuoso> Why the fear of procs?
<dminuoso> You know what a block really is right?
<Bish> not fear.. i think it's cleaner to read for recursive stuff
<dminuoso> It's just a microoptimized proc.
<Bish> dminuoso: you told me, just 2 days ago
<Bish> but it would be cool to be able to reference the current block as a proc
<Bish> so ruby sees it, implicitly creates a proc with same attributes as the block
<dminuoso> You can.
<Bish> inside of a block?
<dminuoso> You just need to do this initially.
<dminuoso> e.g.:
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Bish> thrilling, what will it be
<dminuoso> OH BOY. RUBY I HATE YOU
<dminuoso> One sec.
* Bish waits one sec.
stamina has quit [Quit: WeeChat 1.9.1]
<dminuoso> A = {}; def m(); A[:a] = Proc.new; A[:a].() end; m() { A[:a].() }
<dminuoso> Not sure that this is particularly readable, but hey.
<dminuoso> Im all game when it comes to making nonsense with functions.
<Bish> well, you reference it again..
<Bish> im thinking of a magic variable like $~ which is always there
<dminuoso> Stop using blocks when you want to do shenanigans.
<Bish> that has nothing to do with shenanigans, i am sure this can be useful
<dminuoso> There is no advantage of blocks unless you're writing a core library that cant afford to introduce artificial overhead.
<dminuoso> Bish: If you want something useful, use this: ->(f) { ->(x) { x[x] }[->(x) { f[->(y) { x[x][y] }] }] }
<dminuoso> Lets you do recursion without recursion.
<Bish> well the advantage in this case would be, not to have a proc reference saved somehwere
<Bish> dminuoso: ycombinator? i didn't read it, just guessing
<dminuoso> Yea
<Bish> you can write it that fast out of your head?
<Bish> crazy mf
drowze has quit [Ping timeout: 250 seconds]
<Bish> but that one is actually really readable
<Bish> having seen javascript ones, etc.
<dminuoso> Bish: No its not. :|
<Bish> trying to use it right now
<Bish> how do i break :(
Guest70176 has quit [Ping timeout: 248 seconds]
LebedevRI has left #ruby [#ruby]
vee__ has quit [Ping timeout: 248 seconds]
krawchyk has joined #ruby
<dminuoso> Bish: In Haskell its as simple as: fix f = let x = f x in x
larcara has joined #ruby
nobitanobi has quit [Read error: Connection reset by peer]
<dminuoso> So I dont know about readable.
cschneid_ has joined #ruby
nobitanobi has joined #ruby
Guest70176 has joined #ruby
<Bish> i hope i can lower my selfworth so much i can learn haskell some day
tomphp has joined #ruby
<Bish> so i can finally write good software
tomphp has quit [Client Quit]
<Bish> so far i am not so in on torturing myself
cek has joined #ruby
sepp2k has joined #ruby
cek has left #ruby [#ruby]
vee__ has joined #ruby
andikr has joined #ruby
Technodrome has joined #ruby
cschneid_ has quit [Read error: Connection reset by peer]
Puffball has joined #ruby
d10n-work has joined #ruby
cschneid_ has joined #ruby
Guest70176 has quit [Ping timeout: 240 seconds]
nadir has quit [Quit: Connection closed for inactivity]
silvermine has quit [Ping timeout: 240 seconds]
<dminuoso> And this is my take in haskell with lambdas.
<dminuoso> (Realized that this is the better equivalent of the earlier mentioned combinator)
mim1k has quit [Disconnected by services]
mim1k_ has joined #ruby
Rouge has joined #ruby
<dminuoso> (The typesystem needs slight encouragement)
troys_ is now known as troys
<dminuoso> But it's fairly close to (\x -> x x)(\x -> x x) wouldnt you say? :)
motstgo has left #ruby ["WeeChat 1.9"]
mcr1 has joined #ruby
apparition has quit [Quit: Bye]
kapil___ has joined #ruby
conta has quit [Quit: conta]
conta has joined #ruby
cdg has joined #ruby
Psybur has joined #ruby
daemonwrangler is now known as derek-away
conta has quit [Ping timeout: 240 seconds]
rfoust has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
derek-away is now known as daemonwrangler
mim1k_ is now known as mim1k
milardov_ has joined #ruby
Psybur has quit [Ping timeout: 240 seconds]
milardovich has quit [Ping timeout: 240 seconds]
milardov_ has quit [Remote host closed the connection]
daemonwrangler is now known as derek-away
mark_66 has quit [Remote host closed the connection]
silvermine has joined #ruby
synthroid has quit [Remote host closed the connection]
thinkpad has quit [Ping timeout: 248 seconds]
mim1k has quit [Ping timeout: 268 seconds]
mim1k has joined #ruby
dionysus69 has joined #ruby
zautomata has quit [Ping timeout: 268 seconds]
drowze has joined #ruby
milardovich has joined #ruby
jackjackdripper has joined #ruby
aufi has quit [Quit: Leaving]
ewoud has joined #ruby
vee__ has quit [Ping timeout: 260 seconds]
mtkd has quit [Ping timeout: 248 seconds]
<ewoud> if I want to ship static files in a gem to be used by another gem/script, where would I put them and how would I load them later?
derek-away is now known as daemonwrangler
mtkd has joined #ruby
<adaedra> I think you can put then anywhere in the gem if you reference them in the gem's files attribute
synthroid has joined #ruby
<adaedra> Then you should be able to find it relatively to __dir__
<ewoud> the use case is shipping a bunch of yaml files so I'd have mygem/lib/nodesets.rb and use __dir__ in that nodesets.rb?
bronson_ has joined #ruby
bronson has quit [Read error: Connection reset by peer]
<ewoud> that sounds like it should work
iamarun has quit [Remote host closed the connection]
<dminuoso> Nice.
<dminuoso> So I got a heisenbug somewhere in a native extension. When I now attach valgrind, everything explodes wildly.
<craysiii> hey everyone. trying to implement these data stream endpoints for an api wrapper, but i see that faraday hasn't implemented data streams yet. can anyone recommend an appropriate gem?
synthroid has quit [Ping timeout: 248 seconds]
Dimik has joined #ruby
jaruga has quit [Quit: jaruga]
<ewoud> adaedra: thanks, looks like that's exactly what I was looking for
cschneid_ has quit [Read error: Connection reset by peer]
cschneid_ has joined #ruby
Technodrome has quit [Read error: Connection reset by peer]
Guest70176 has joined #ruby
vee__ has joined #ruby
<dminuoso> Thank you ruby.
<dminuoso> This is how useful diagnostics work.
Rouge has quit [Remote host closed the connection]
zautomata has joined #ruby
milardov_ has joined #ruby
ShekharReddy has quit [Quit: Connection closed for inactivity]
Rouge has joined #ruby
vee__ has quit [Ping timeout: 240 seconds]
milardovich has quit [Ping timeout: 258 seconds]
kryptoz has quit [Remote host closed the connection]
kryptoz has joined #ruby
kryptoz has quit [Remote host closed the connection]
wolfshappen has quit [Quit: Waffs have technical problems too]
Serpent7776 has quit [Quit: Leaving]
wolfshappen has joined #ruby
mson has quit [Quit: Connection closed for inactivity]
rikkipitt has joined #ruby
mson has joined #ruby
Psybur has joined #ruby
cdg has quit [Remote host closed the connection]
mtkd has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
kickr_ has quit [Quit: Leaving]
mcr1 has quit [Ping timeout: 240 seconds]
Guest70176 has quit [Ping timeout: 260 seconds]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
vee__ has joined #ruby
Psybur has quit [Ping timeout: 248 seconds]
Guest70176 has joined #ruby
kickr has joined #ruby
<mikecmpbll> hmm. it's a shame that 2.4's Enumerable#sum doesn't have any native performance boost for arrays of BigDecimal.
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<mikecmpbll> about 8* faster for floats
<mikecmpbll> (than [].reduce :+ )
synthroid has joined #ruby
raynold has quit [Quit: Connection closed for inactivity]
ewoud has left #ruby [#ruby]
Beams has quit [Quit: .]
ShekharReddy has joined #ruby
mim1k has quit [Ping timeout: 258 seconds]
jamiejackson has joined #ruby
exhiled has joined #ruby
rikkipitt has quit [Remote host closed the connection]
rikkipitt has joined #ruby
wolfshappen has quit [Ping timeout: 268 seconds]
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
uZiel has quit [Remote host closed the connection]
milardovich has joined #ruby
milardovich has quit [Remote host closed the connection]
exhiled has joined #ruby
Guest70176 has quit [Ping timeout: 240 seconds]
rikkipitt has quit [Ping timeout: 240 seconds]
nobitanobi has quit [Remote host closed the connection]
Emmanuel_Chanel has quit [Quit: Leaving]
milardov_ has quit [Ping timeout: 248 seconds]
synthroi_ has joined #ruby
mtkd has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
Guest70176 has joined #ruby
synthroid has quit [Ping timeout: 240 seconds]
wolfshappen has joined #ruby
Guest70176 has quit [Ping timeout: 255 seconds]
ldepandis has joined #ruby
mtkd has quit [Read error: Connection reset by peer]
mtkd has joined #ruby
ur5us has joined #ruby
Emmanuel_Chanel has joined #ruby
Emmanuel_Chanel has quit [Remote host closed the connection]
ramfjord has joined #ruby
eckhardt has joined #ruby
uZiel has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
vee__ has quit [Ping timeout: 248 seconds]
mcr1 has joined #ruby
rabajaj has joined #ruby
Emmanuel_Chanel has joined #ruby
kies has quit [Ping timeout: 248 seconds]
Psybur has joined #ruby
cdg has joined #ruby
Scorpion has joined #ruby
nofxx has quit [Read error: Connection reset by peer]
TomyWork has quit [Ping timeout: 240 seconds]
nofxx has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
RickHull has joined #ruby
Ltem has joined #ruby
vee__ has joined #ruby
Psybur has quit [Ping timeout: 258 seconds]
bvcosta has joined #ruby
daemonwrangler is now known as derek-away
kies has joined #ruby
orbyt_ has joined #ruby
bvcosta_ has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
derek-away is now known as daemonwrangler
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tlaxkit has joined #ruby
orbyt_ has quit [Client Quit]
truenito has quit [Ping timeout: 268 seconds]
bvcosta has quit [Ping timeout: 258 seconds]
[Butch] has joined #ruby
exhiled has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
<weaksauce> so after updating to high sierra I am trying to use capistrano to deploy but the gemfile is complaining about ruby version not being correct. I use chruby and select the correct version but every time it runs it switches to 2.3.3... all my `which bundler` and `which cap` and `which ruby` all point to the correct 2.1.3
<weaksauce> any ideas where to start?
<havenwood> weaksauce: are you using sudo?
cdg has quit [Remote host closed the connection]
<weaksauce> in what sense havenwood
cdg_ has joined #ruby
<havenwood> weaksauce: in the command you're running to deploy
<weaksauce> the command i am using is `chruby 2.1.3 && be cap production deploy` where be is an alias to bundle exec
<havenwood> weaksauce: ah, I think I misread what you wrote
<havenwood> weaksauce: have you seen cap's wiki on chruby?: https://github.com/capistrano/chruby#readme
raynold has joined #ruby
<weaksauce> have yeah. it was all working fine until i upgraded to high sierra
<havenwood> weaksauce: and chruby's wiki on chruby: https://github.com/postmodern/chruby/wiki/Capistrano
milardovich has joined #ruby
<havenwood> weaksauce: hrmmm
<weaksauce> i don't get it
<weaksauce> maybe i just blow out the gems and try bundle install?
<weaksauce> reinstall bundler?
ledestin has joined #ruby
milardov_ has joined #ruby
guille-moe has quit [Ping timeout: 258 seconds]
mfb2 has joined #ruby
muelleme has joined #ruby
Puffball has quit [Remote host closed the connection]
<weaksauce> i do a `be ruby --version` and it spits out the correct version
<weaksauce> it's something to do with capistrano as just trying to do a `be cap --version` spits out the error
milardovich has quit [Ping timeout: 240 seconds]
Puffball has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
wolfshappen has quit [Ping timeout: 255 seconds]
ramfjord has quit [Ping timeout: 255 seconds]
<weaksauce> though actually bundler fails with the same message if i try to run a `bundle install` so `bundle exec ruby --version` works but `bundle install` fails
ramfjord has joined #ruby
wolfshappen has joined #ruby
urk187 has joined #ruby
daemonwrangler is now known as derek-away
marr has quit [Ping timeout: 248 seconds]
derek-away is now known as daemonwrangler
andikr has quit [Remote host closed the connection]
eightlimbed has joined #ruby
selim has quit [Ping timeout: 248 seconds]
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
cahoots has joined #ruby
jaruga has joined #ruby
selim has joined #ruby
<cahoots> hi, i want to use mechanize to log in at https://www.fabric.io/login, but mechanize seems unable to find the form. any ideas how to solve this?
tvw has quit [Remote host closed the connection]
kryptoz has joined #ruby
<Rouge> here is my code
<RickHull> mechanize, wow -- it's been a while since I've heard that library
<Rouge> anyone able to explain why its not running
<RickHull> cahoots: there is no HTML form on that page
<ruby[bot]> Rouge: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/0ee65982e5258fff7db5f8ee80f68257
<ruby[bot]> Rouge: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
<RickHull> Rouge: are there any errors?
<Rouge> memory error
<Rouge> #<Name:0x0000000004c8d828>
<Rouge> im just a beginner. trying to work on classes
<RickHull> can you paste the full error?
<Rouge> C:\Ruby24-x64\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/Rouge/IdeaProjects/FurtherRuby/Object_oriented/testing.rb
<Rouge> #<Name:0x0000000004c8d828>
<Rouge> Process finished with exit code 0
<RickHull> don't need the full stack trace
<apeiros> Rouge: if you have a local variable named `title`, then doing `title` will no longer call the method with that name
MrBusiness has quit [Quit: https://www.youtube.com/watch?v=xIIqYqtR1lY -- Suicide is Painless - Johnny Mandel]
<Rouge> as in having title as a method and a variable?
<cahoots> RickHull, when i open up the source code, i see a form with class .sdk-form
<RickHull> interesting, when I view source -- the only form ctrl-f can find is in "platform"
<cahoots> perhaps some js is adding it dynamically and mechanize only picks up on the initial html download?
kryptoz has quit [Ping timeout: 248 seconds]
<cahoots> RickHull, inspect one of the form fields
<cahoots> then in that source code view, you'll see the form
<RickHull> i believe mechanize will just look at the page source, which has no form elements -- not sure
griffindy has joined #ruby
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
griffindy has quit [Client Quit]
Psybur has joined #ruby
<RickHull> Rouge: I'm surprised your last line, L30 doesn't have an error
rfoust has joined #ruby
<weaksauce> anyone know why bundle would use system default ruby over the ruby that I select from chruby? bundle install uses system ruby bundle exec ruby --version uses the correct one selected by chruby
<Rouge> RickHull, yeah i sort of know thats wrong
<Rouge> but im getting that memory error
<Rouge> regardless of that line
<RickHull> Rouge: I don't see any memory errors
<Rouge> what do you get when you run code?
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RickHull> i haven't tried, because it looks like L30 has a simple error
<Rouge> deleting line 30
<Rouge> gives same error
<RickHull> what error?
<Rouge> C:\Ruby24-x64\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/Rouge/IdeaProjects/FurtherRuby/Object_oriented/testing.rb
<Rouge> #<Name:0x0000000004c1dcd0>
<Rouge> Process finished with exit code 0
<RickHull> i still don't see any errors
<RickHull> the 2nd line there is just an inspect string, it looks like
<Rouge> gime 2 mins
<Rouge> sorry got mixed on a window
<Rouge> em yeah
<Rouge> so the name = Name.new
<RickHull> I'm not sure if your -e is working as expected -- I would just put that code in the .rb file and call ruby.exe script.rb
eckhardt has joined #ruby
<Rouge> my l30 needs arguments
<RickHull> yes
cahoots has quit [Ping timeout: 268 seconds]
cahoots_ has joined #ruby
<Rouge> which should be
Psybur has quit [Ping timeout: 240 seconds]
<Rouge> name = Name.new(title, last_name, middle_name, last_name)
<Rouge> ?
<RickHull> probably you would just put string literals in there: Name.new('king', 'john', 'q', 'public')
<haylon> Hey everyone. Has anyone worked with JRuby and Ant tasks? I'm not sure what I would need to do with my Rake task to make it so I can include the Manifest into my JAR file.
<Rouge> RickHull, yeah im trying to get from user input
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<RickHull> Rouge: you should decide between: create the object with values provided, or else create an empty object and prompt the user
LocaMocha has quit [Ping timeout: 240 seconds]
zautomata has quit [Ping timeout: 248 seconds]
Winwin has joined #ruby
milardovich has joined #ruby
daemonwrangler is now known as derek-away
derek-away is now known as daemonwrangler
hays has joined #ruby
<hays> Anyone use ruby-installer? Curious how you upgrade your rubies
hays has quit [Changing host]
hays has joined #ruby
eightlimbed has quit [Ping timeout: 248 seconds]
<hays> Anyone use ruby-installer? Curious how you upgrade your rubies
exhiled has joined #ruby
goyox86 has joined #ruby
silvermine has quit [Ping timeout: 258 seconds]
<hays> it seems like it might be a pretty manual process of installing the new one, reinstalling gems, then deleting the old
<haylon> @hays I usually just run the RubyInstaller for Windows and it took care of the upgrade .
<haylon> are you on Windows or something else?
<hays> oh sorry, mac/homebrew
<haylon> Ah, I use rbenv on MacOS
<haylon> and my Linux machines.
<hays> i use it with chruby to keep 2.2, 2.3, 2.4 all on my system
<hays> ahh rbenv. I'm not experienced with that, since im using chruby
Rapture has quit [Ping timeout: 248 seconds]
exhiled has quit [Client Quit]
ShekharReddy has quit [Quit: Connection closed for inactivity]
milardov_ has quit [Ping timeout: 268 seconds]
lxsameer has quit [Ping timeout: 240 seconds]
nadir has joined #ruby
Winwin has quit [Excess Flood]
kitsunenokenja has joined #ruby
muelleme has quit [Ping timeout: 268 seconds]
cdg_ has quit [Remote host closed the connection]
<RickHull> hays: do you mean ruby-install ?
Cohedrin has joined #ruby
<hays> RickHull: yes
<RickHull> generally ruby-install and chruby are used together, or ruby-build and rbenv
<hays> yeah, i am curious if there is a way to upgrade the rubies to the latest minor versions or something similar
<RickHull> to "upgrade" a ruby means to install a newer version. so if you have ruby-2.4.0, you can install ruby-2.4.1
<RickHull> (etc)
AlexRussia has joined #ruby
<weaksauce> I use ruby-install and chruby. usually works just fine other than bundler trying to use the system ruby now
goyox86_ has joined #ruby
<haylon> So you'd have two versions, the old one and newer one
goyox86 has quit [Ping timeout: 268 seconds]
goyox86_ is now known as goyox86
goyox86 has quit [Client Quit]
<hays> ok so people just manage this manually
<RickHull> try ruby-install --latest
<hays> install new ruby, move gems over, delete the old one
<hays> I have 5 rubies I keep going
<RickHull> that's right -- it's meant to be an isolated environment tied to the ruby version
<RickHull> unlike doing say `apt upgrade`
<hays> jruby, ruby 2.2, 2.3, 2.4,rbx
dionysus69 has quit [Ping timeout: 248 seconds]
<hays> so its a bit of a maintenance item for me
knight33 has joined #ruby
mtkd has quit [Read error: Connection reset by peer]
<hays> I wonder i gem install < list.txt works
<RickHull> there may be a way to move the gems over, or it would be easily scriptable if not
<RickHull> havenwood: ^
mtkd has joined #ruby
<RickHull> hays: in general, I would just develop on one or two ruby versions, and use travis (or similar) to test on other rubies
<havenwood> hays: so the problem with using gems between teeny versions of ruby is actually the gem executable shebangs.
<havenwood> hays: you can get an env-based shebang with the --env-shebang flag.
<havenwood> hays: i do set that flag in my gemrc so i'm able to use gems when i upgrade Ruby to an ABI-compatible version with previously installed gems
<havenwood> hays: gem: "--env-shebang"
<haylon> btw, figured out my problem with my JRuby stuff. I wasn't undersatnding how it was dealing with the XML "translations". Had a do...end in the wrong spot
<havenwood> ^ that in your ~/.gemrc should do the trick
<RickHull> havenwood: just to make it clear, say ruby-2.4.0 is installed with 10 gems; if ruby-2.4.1 is then installed, with the ~/.gemrc env-shebang thing, those 10 gems will be available for 2.4.1 ?
<havenwood> RickHull: yes
<havenwood> RickHull: the fix so that *just happens* has been PRed to RubyGems but last I recall it was awaiting a breaking version bump to go live.
<hays> hmm. that works with chruby?
bvcosta_ has quit []
<havenwood> sec, i'll find the issue
<havenwood> hays: yes
<hays> neat
<hays> modern environments are so complex.. i don't really follow how they are setup anymore. its just a bit of magic
<RickHull> in this case, it's not too bad. ruby executables live in some bin/ somewhere, and PATH manipulation finds them. likewise, rubygems stuff has its own filesystem layout, and you just need the right config to point to them
ur5us has joined #ruby
ShekharReddy has joined #ruby
<weaksauce> RickHull you have any idea why bundler would use the system ruby over the chruby that it should?
<RickHull> a lot of this is hidden from end users by tooling
<RickHull> weaksauce: it could be that bundler is looking for ruby before executing any chruby hooks
<havenwood> weaksauce: make sure bundler is installed with the chruby version of ruby you've selected
<havenwood> weaksauce: gem install bundler
<havenwood> weaksauce: confirm: which bundle
<havenwood> weaksauce: and: gem which bundler
<weaksauce> i get a segfault on the second command gem which bundler havenwood
<weaksauce> the first command looks correct though
eightlimbed has joined #ruby
FrostCandy has joined #ruby
<weaksauce> where do gems get installed normally?
<weaksauce> i want to just blow out everything and start over
<RickHull> weaksauce: run `gem which` without any chruby hooks
<RickHull> er, `gem env`
<RickHull> that means using your system `gem` -- so either don't run chruby hooks on a new bash session, or find the path and execute it directly
Rapture has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> weaksauce: no use of sudo involved? take a look at your $PATH env var, is it as expected?
<havenwood> echo $PATH
jackjackdripper has quit [Quit: Leaving.]
<weaksauce> havenwood no sudo. this is all because i updated to high sierra and everything was working fine before that
hays has quit [Remote host closed the connection]
<weaksauce> the path does look a bit funky havenwood though I don't see anything inside my .zshenv that would set that other than chruby perhaps?
eightlimbed has quit [Remote host closed the connection]
eightlimbed has joined #ruby
milardov_ has joined #ruby
<weaksauce> is it normal to have all those ruby bins in the bath?
<dminuoso> weaksauce: Also there are interesting edge cases where shell hash/caches can force wrong binaries to be executed.
<dminuoso> 21:01 weaksauce | i get a segfault on the second command gem which bundler havenwood
<dminuoso> That sounds like a bug.
milardovich has quit [Ping timeout: 240 seconds]
<weaksauce> dminuoso yeah, for sure. it's likely the wrong ruby being used against a gem built for a different version of ruby
enterprisey has quit [Remote host closed the connection]
cdg has joined #ruby
<dminuoso> weaksauce: have you used `hash -r` for good measure?
Psybur has joined #ruby
cdg has quit [Ping timeout: 255 seconds]
ta_ has joined #ruby
Psybur has quit [Ping timeout: 240 seconds]
milardov_ has quit [Remote host closed the connection]
milardovich has joined #ruby
kus_ubuntui686 has joined #ruby
marr has joined #ruby
ldnunes has quit [Remote host closed the connection]
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
<weaksauce> tried it to no avail
vee__ has quit [Ping timeout: 248 seconds]
kitsunenokenja has quit [Ping timeout: 252 seconds]
milardovich has quit [Ping timeout: 268 seconds]
bmurt has joined #ruby
<weaksauce> everything points to 2.1.3 and yet it thinks it is running 2.3.3
<havenwood> weaksauce: gem pristine --all
<weaksauce> the problem with that is that those gems that it is complaining about are the ones from the system ruby
impermanence has joined #ruby
<weaksauce> alright. blowing out the ~/.gem folder seems to have fixed something
truenito has joined #ruby
minimalism has quit [Quit: minimalism]
mson has quit [Quit: Connection closed for inactivity]
Rouge has quit [Ping timeout: 248 seconds]
jamesaxl has quit [Quit: WeeChat 1.9.1]
cahoots_ has quit [Ping timeout: 240 seconds]
truenito has quit [Ping timeout: 248 seconds]
tomphp has joined #ruby
vee__ has joined #ruby
zautomata has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
TinkerTyper has quit [Read error: Connection reset by peer]
TinkerTyper has joined #ruby
troys is now known as troys_
vee__ has quit [Ping timeout: 255 seconds]
safetypin has quit [Ping timeout: 260 seconds]
br0d1n has quit [Quit: Leaving]
impermanence has quit [Remote host closed the connection]
Rapture has quit [Ping timeout: 250 seconds]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
jaruga has quit [Ping timeout: 240 seconds]
dp has joined #ruby
cahoots has joined #ruby
<dp> Are there any tools that will take a directory of ruby classes/scripts/etc and build some kind of map showing how everything is intertwined so I can trace down the issue that I'm having? Maybe even something to generate html documentation for them?
milardovich has joined #ruby
<apeiros> dp: rdoc and yard
Rouge has joined #ruby
<dp> apeiros: awesome, thanks!
dp has quit [Client Quit]
eckhardt has joined #ruby
ap4y has joined #ruby
shinnya has joined #ruby
vee__ has joined #ruby
milardovich has quit [Ping timeout: 268 seconds]
eightlimbed has quit [Ping timeout: 240 seconds]
leitz has joined #ruby
daemonwrangler is now known as derek-away
rabajaj has quit [Remote host closed the connection]
mjolnird has quit [Remote host closed the connection]
Psybur has joined #ruby
mfb2 has quit [Remote host closed the connection]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cdg has joined #ruby
vee__ has quit [Ping timeout: 240 seconds]
Ltem has quit [Quit: Leaving]
eightlimbed has joined #ruby
Psybur has quit [Ping timeout: 250 seconds]
Rapture has joined #ruby
drowze has quit [Ping timeout: 268 seconds]
knight33 has joined #ruby
oetjenj has joined #ruby
eightlimbed has quit [Ping timeout: 248 seconds]
Rouge has quit [Ping timeout: 240 seconds]
vee__ has joined #ruby
houhoulis has joined #ruby
cahoots_ has joined #ruby
milardovich has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
reber has quit [Remote host closed the connection]
cahoots has quit [Ping timeout: 240 seconds]
d10n-work has quit [Quit: Connection closed for inactivity]
carnegie has joined #ruby
knight33 has joined #ruby
milardovich has quit [Ping timeout: 240 seconds]
cdg has quit [Ping timeout: 250 seconds]
rainbowz has joined #ruby
mikeiniowa has quit [Remote host closed the connection]
Cohedrin has quit [Read error: Connection reset by peer]
lexruee has quit [Ping timeout: 255 seconds]
megamosaren has joined #ruby
Cohedrin has joined #ruby
mikeiniowa has joined #ruby
<leitz> Design question. Class Character holds data and a few methods. Mixin CharacterTools has all the stuff to modify CharacterData. Presenter is used to format output. Right now Character requires CharacterTools, is it an issue that a bunch of methods are mixed in even though they only get used on initialization?
mson has joined #ruby
lexruee has joined #ruby
muelleme has joined #ruby
<weaksauce> not sure what you are asking leitz
synthroi_ has quit []
<weaksauce> what's your concern about it?
<leitz> Mostly bloated code. The first version had all the methods directly in Class Character. Wasn't sure if the mixin was as bloated or what.
<leitz> There will be other mixins, trying to figure out how to prepare for them.
<weaksauce> i wouldn't worry too much about bloat at this stage... were you able to refactor that long method from earlier?
<leitz> Wondering if there's a Design Pattern to solve the issue and give me a reason to learn patterns.
<leitz> Removed 11 lines, added sample. The next round of refactor is what has me on this question.
<weaksauce> nice. design is a bit nebulous at times and sometimes there are no great ways to do something only less bad ways
<leitz> hehe...
<weaksauce> a factory might be the pattern you are looking for
<weaksauce> if it's only about initialization stuff
<leitz> Yup, most of the data will be set once and then done.
<leitz> But the Character doesn't need to carry all the other stuff.
* leitz found a blog post on factory.
milardovich has joined #ruby
<weaksauce> internally the mixins don't get added to every object of that class. they get added to the definition of the class and then that's used at runtime.(unless you redefine it on the actual object)
<weaksauce> the factory pattern is used heavily in java and less so in ruby
tvw has joined #ruby
<leitz> So the next task should be "trim methods" as opposed to "Figure out factory"?
<weaksauce> i would say so yeah.
carnegie has quit [Remote host closed the connection]
jaruga has joined #ruby
<leitz> Okay, let me see what I can do. I have the next few days off.
carnegie has joined #ruby
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
urk187 has quit [Remote host closed the connection]
tlaxkit has quit [Quit: ¡Adiós!]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
jaruga has quit [Client Quit]
carnegie has quit [Remote host closed the connection]
carnegie has joined #ruby
<weaksauce> leitz design in programming is one of the more contentious issues programmers face off on... in general rubists are for small easily testable methods though. long methods are a code smell.
milardovich has quit [Ping timeout: 248 seconds]
<RickHull> leitz: FWIW I am not a fan of mixins
<leitz> RickHull, you would be if you read my original code.
<RickHull> link to Character class?
larcara has quit [Remote host closed the connection]
<RickHull> ok, a couple things:
qu1j0t3 has joined #ruby
<RickHull> 1. don't manipulate load path in code -- if your code file is inside lib/ then you can just: require 'other/stuff'
<qu1j0t3> hello. Is there an alternative rspec helper for REST-ish integration tests, to Airborne?
<RickHull> e.g. within lib/this_file.rb, to require lib/other/stuff.rb -- just require 'other/stuff'
<RickHull> this will fail if lib/ is not in your load path, but you can put it there from the outside, not from the inside
<leitz> Originally code is in bin. Reading yesteryday that it should go in lib
carnegie has quit [Quit: Leaving...]
<RickHull> yes, put your class definitions in lib
<RickHull> module and class definitions
<Radar> baweaver: a book on Elixir.
<Radar> Re: [17:27:32] <baweaver>Just ask Radar, he's even writing a book for it
<leitz> This isn't a gem yet, so the load path needs to be explicit, as I understand it.
<RickHull> leitz: if it were a gem, rubygems would do your load path manipulation, yes
<RickHull> but you can do it on your own from the outside
<leitz> RickHull, wait. Does the main program go in lib or bin?
<RickHull> (and should)
<weaksauce> leitz also, generally, the ruby style is to omit () when calling methods without arguments
<RickHull> leitz: the main program, or driver program, should probably go in bin/
<leitz> Ah, okay. Got one right. :)
krawchyk has quit [Ping timeout: 240 seconds]
<RickHull> then you can do: ruby -Ilib bin/driver.rb
<RickHull> the `-I lib` part is your load path manipulation from the outside
<RickHull> (which rubygems does for you)
<leitz> Ah. Cool.
<leitz> Currently all the paths are manipulated inside the files.
<RickHull> so forget about rubygems for now -- just make sure to do `-I lib` when you call irb, pry, or ruby
<RickHull> leitz: yeah, rip that stuff out
<weaksauce> leitz lines 26-31 could follow the pattern of @upp = CharacterTools.generate_upp and make those class methods
<weaksauce> instead of a mixin
<RickHull> and just require 'this/class' or require 'that_class'
<RickHull> next, put your requires at the top, outside of the class
<RickHull> it's ok to do a conditional require inside a method -- but frowned upon
<leitz> Yeah, there's a question on that coming up. Conditional requires.
<leitz> Not today though.
<RickHull> for now, don't do them
<RickHull> they are very rarely justifiable
<RickHull> it's much better to be explicit and straightforward about what your file depends on to work properly
<RickHull> it would be a hack/optimization to abandon this principle
<leitz> weaksauce, which lines 26-31 are you looking at?
<leitz> RickHull; there's a large group of careers to use for data, depending on the career the person chooses.
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Psybur has joined #ruby
<RickHull> sure, I suspect we can make this work in a straightforward way
<RickHull> that said, there a couple more aesthetic things that would be worth fixing sooner rather than later
nopolitica has joined #ruby
<leitz> weaksauce, CharacterTools is a mixin, would it still crete "class methods"?
<leitz> RickHull, yup. Working on the first round of refactoring. Long list of fixes. :)
<RickHull> ruby conventions say, for a class like CharacterToolStuffThingie, that the file should be named character_tool_stuff_thingie.rb
<weaksauce> leitz make it a class instead of a module and then make the methods class methods
megamosaren has quit [Quit: Leaving]
<RickHull> ruby projects generally never have uppercase letters in filenames
<RickHull> i'm sure it will be annoying to try to change all of this and lots of stuff will break
<RickHull> and right now you are itching to figure out conceptual stuff
<RickHull> but try to consider whether it will be better to fix the aesthetics sooner or later
<leitz> Okay, help me prioritize. 1) Change CharacterTools to a class with class methods. 2) Refactor methods so they are cleaner first. Which is best to start on?
<leitz> Or is there a third or forth option?
<leitz> fourth
<RickHull> I recommend 1. fix aesthetics (load path, requires, filenames)
<RickHull> don't make any functional changes
<RickHull> assuming your tests pass now, you can fix the aesthetics and make sure tests still pass
<RickHull> some tests will need some editing, presumably, as they will require filenames that have changed
<RickHull> and you are probably doing other unnecessary load path manipulation in code
<RickHull> if you execute your tests with a Rake::TestTask -- rake does the load path for you
<RickHull> otherwise, I just execute a single test file like: `ruby -Ilib test/the_file.rb`
cdg has joined #ruby
<RickHull> and my test files are written so that they require what they need and execute successfully, barring a test failure
<leitz> Current tests fail one on one but pass under the testsuite
rikkipitt has joined #ruby
Psybur has quit [Ping timeout: 248 seconds]
<RickHull> ok, that's kind of a concern
<leitz> weaksauce, weigh in on priority?
polishdub has quit [Quit: leaving]
<leitz> RickHull, yup. I think it's back to the load path.
Rouge has joined #ruby
<weaksauce> first_name_query = db.prepare "SELECT * from humaniti_#{gender}_first ORDER BY RANDOM() LIMIT 1" something like that could be all in one database with a few more columns. like species, and gender that you then limit with a where clause
<RickHull> leitz: what I would do is rip out the load path stuff, and change the requires so they do lowercase
tomphp has joined #ruby
<RickHull> then without changing anything else, you can `ruby -Ilib test/tc_Army.rb`
<weaksauce> leitz i'd probably change the lower hanging fruit like RickHull suggested
<RickHull> (and it will fail because it can't require 'army')
<RickHull> then go and rename lib/Army.rb to lib/army.rb
<RickHull> see what fails, rename, rinse, repeat
<leitz> Sounds like a good evening. :) New branch "refactor_muster_out", using a broad definition of "refactor".
<RickHull> hm, where does Army.rb even live?
<leitz> Careers/Archive. I changed the layout and only put a few in the new format.
<RickHull> so you would: require 'careers/archive/army'
tomphp has quit [Client Quit]
<RickHull> and rename Army.rb to army.rb
<RickHull> now some other stuff in lib/ may not be able to find it
<RickHull> but you can use test/tc_Army.rb to drive your changes until that file passes tests
<leitz> Would probably reformat it and move it out of archive. Only the Chargen and Tests need it.
<RickHull> i wouldn't start reorganizing at the same time
<RickHull> just change one set of things at a time. lowercase filenames e.g.
AlexRussia has quit [Ping timeout: 240 seconds]
<RickHull> rip out load path stuff, and move requires to the top, and rename files to lowercase
jackjackdripper has joined #ruby
<RickHull> all of those can be done at once -- and you are just dealing with requires
tomphp has joined #ruby
troys_ is now known as troys
<leitz> So tc_navy.rb should require tools/character_tools and careers/navy?
mim1k has joined #ruby
<leitz> Assuming I use ruby -llib test/tc_navy.rb
<RickHull> yes, presumably
<RickHull> it depends on what classes / methods etc are called by test/tc_navy.rb
<RickHull> at the top of test/tc_navy.rb should be a number of requires according to what test/tc_navy.rb calls
<RickHull> for my test files, I generally have 2 or 3 requires: require 'minitest/autorun; require 'some_class'; require 'maybe/some/other/module'
<leitz> Well, let me go blow things up and see what happens.
<RickHull> sometimes you can have a test_helper.rb or spec_helper.rb
<RickHull> in that case, it doesn't live in lib/ and so the standard `-I lib` won't help you
<RickHull> that's where you require_relative `./spec_helper`
<RickHull> er, `require_relative './spec_helper'`
<RickHull> e.g. from within test/tc_navy.rb assuming test/spec_helper.rb exists
bilal80 has joined #ruby
<RickHull> i'm not sure if `require_relative 'spec_helper'` works or if `require_relative './spec_helper'` is needed
milardovich has joined #ruby
mim1k has quit [Ping timeout: 248 seconds]
<RickHull> you might think that you could `-I lib -I test` but in my projects at least, the filenames in lib/ and test/ would conflict and require would get confused
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
mfb2 has joined #ruby
<RickHull> also, it's good to do this work on a branch, if you're comfortable with that
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
<leitz> Okay, so I'm running "ruby -llib test/tc_navy.rb" and getting a LoadError on line 6, tools/character_tools.
<RickHull> is there a branch or something where I can see the latest code?
<leitz> Took me a sec to get there.
<RickHull> nice, this much looks good
<leitz> Running command from parent directory.
<RickHull> oh, it's -I as in Irene
mfb2 has quit [Ping timeout: 240 seconds]
<RickHull> and you would have to be in your project dir, where `cd lib` would succeed
rikkipitt has quit [Remote host closed the connection]
AlexRussia has joined #ruby
<leitz> Yup. Totally different error. Lemme go fix it.
<RickHull> require 'tools/character_tools' should succeed
<RickHull> but that file may have its own requires that are failing
<leitz> And you using "Irene" is funny, as the fiction I'm working on has Irene as a major character. :)
<RickHull> (which would make the first require ultimately fail)
rikkipitt has joined #ruby
rikkipit_ has joined #ruby
* leitz is busy blowing up stuff and trying to fix it.
rikkipitt has quit [Read error: Connection reset by peer]
FrostCandy has quit []
<leitz> Cool, update your look at the repo. tc_navy passes.
<leitz> Of course, nothing else does. :P
<RickHull> yep, one step at a time
<RickHull> you've got a lot of files with references to each other
<RickHull> it will probably take 30-90 min to nail all this down
DoubleMalt has quit [Ping timeout: 240 seconds]
<RickHull> but it will be well worth it
muelleme has quit [Ping timeout: 248 seconds]
<leitz> Does the test suite's require need the "test/" prefix on the files?
rikkipit_ has quit [Quit: Leaving...]
<leitz> Like, require "test/tc_navy"
<leitz> or just require "tc_navy"
kitsunenokenja has joined #ruby
mfb2 has joined #ruby
<leitz> Or -Ilib Itest
<RickHull> generally you aren't requiring test files
<leitz> That works.
<RickHull> generally you execute test files
<RickHull> the one case is what I mentioned earlier, sometimes you have e.g. test/test_helper.rb
yokel has quit [Remote host closed the connection]
<RickHull> which maybe does some general requires and/or defines some helper methods
<RickHull> in that case, use `require_relative` within your test files that need the helper
<RickHull> in general, `-I test` is a bad idea
bilal80 has quit [Ping timeout: 248 seconds]
<RickHull> so if test/tc_navy.rb needs test/test_helper.rb, test/tc_navy.rb can do: require_relative './test_helper'
<leitz> The test suite requires the individual test cases. At least at the moment. https://github.com/LeamHall/CT_Character_Generator/blob/refactor_muster_out/test/ts_ct_character_generator.rb#L32
JBbanks has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
<leitz> Breaking it up like that let me work on one set of things at a time but still keep testing.
yokel has joined #ruby
ruby[bot] has joined #ruby
<leitz> Ah, require_relative tc_navy
mfb2 has quit [Ping timeout: 260 seconds]
* leitz goes to beat up the Nobles.
gone_haywire has quit [Ping timeout: 248 seconds]
mfb2 has joined #ruby
<RickHull> in general, if your file in test/ has tests, you don't want to require it
<leitz> How do you do sets of tests?
<RickHull> you would only want to require a file in test/ if that file contains class/module/method definitions, or possibly some common requires
char_var[buffer] has joined #ruby
<RickHull> the basic way: `ruby -Ilib test/*.rb` # should work
<RickHull> or use Rake::TestTask
<RickHull> inside your Rakefile
<RickHull> each file that contains tests should just run on its own, and your test suite consists of running each of these files on their own
ta_ has quit [Read error: Connection reset by peer]
<leitz> That's currently what the ts file does, though it sounds incorrectly.
<RickHull> when I say run on its own, I mean execute as passed to ruby, e.g. `ruby -Ilib test/tc_navy.rb`
thinkpad has joined #ruby
<RickHull> you would not try to execute test/tc_navy.rb via require
jackjackdripper1 has joined #ruby
jackjackdripper has quit [Ping timeout: 240 seconds]
mfb2 has quit [Ping timeout: 248 seconds]
<RickHull> let me say that, what I am describing is the baseline way to run tests -- it may be possible and even desirable to run tests via require or some other structural methodology
rainbowz has quit [Ping timeout: 258 seconds]
ta_ has joined #ruby
<RickHull> but I think it's better to understand the baseline -- and only go beyond it as necessary. I've never felt a need to
<RickHull> if you understand how things at a baseline level, you will have much better judgment for deciding do things differently
<weaksauce> i do like the baseline method because it removes some complications
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
<leitz> So, I don't know Rake yet.
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<RickHull> I see you have a rakefile
<RickHull> I'd rename it to Rakefile but it really doesn't matter
<weaksauce> rake is basic. just an easy way to call methods from the command line
<leitz> That was to get travis-ci not to choke. More a cut and paste effort.
heinrich5991 has quit [Ping timeout: 246 seconds]
tenderlove has quit [Ping timeout: 248 seconds]
<leitz> BTW, tc_noble passes tests.
lupine has quit [Ping timeout: 240 seconds]
<weaksauce> leitz one method is to just do a Dir.each("pathtotestdir") do |testfile| ruby testfile end or something along those lines to not have to have a file full of tests to run
knight33 has joined #ruby
<weaksauce> use globs to only get the files that start with test etc.
<RickHull> nah, see Rake::TestTask
<RickHull> just define a pattern
<weaksauce> but the method that RickHull uses is easier
<RickHull> and rake handles the load path stuff for you
<leitz> RickHull, the rake/testtask file isn't there.
<RickHull> you may need the rake gem installed
<RickHull> but I'd expect its available in stdlib with any recent ruby
<leitz> But line 4 would be t.pattern = 'test/tc_*.rb' ?
<RickHull> here are some common patterns:
<leitz> Ah, that references rake, not a directory in your tree.
<RickHull> test/*.rb
<RickHull> test/test_*.rb
<RickHull> test/**/*.rb
larcara has joined #ruby
<RickHull> test/tc_*.rb is workable, if that's what you want
<RickHull> you can define several Rake::TestTasks with different names
mjolnird has joined #ruby
kitsunenokenja has quit [Ping timeout: 250 seconds]
lupine has joined #ruby
<RickHull> that execute different suites, defined by pattern
<weaksauce> ** is a recursive glob if you didn't know so it will expand every directory under test and run every .rb file
<RickHull> i tend to put all my test files in a flat dir structure in test/
<RickHull> and i'll put some benchmark stuff in test/bench/
<RickHull> so i'll have Rake::TestTask.new(:test) and Rake::TestTask.new(:bench)
<RickHull> with patterns test/*.rb and test/bench/*.rb
<RickHull> that way, the bench stuff isn't run when I just want tests
<RickHull> if the pattern were test/**/*.rb then the bench stuff would get run
<weaksauce> you can also do something like test/tests/integration/*.rb and test/tests/unit/*.rb and whatever else. if you want to run all the tests just do test/tests/**/*.rb... there is a lot of different options here depending on how big your test suite gets and how granular you want to be.
Psybur has joined #ruby
bilal80 has joined #ruby
larcara has quit [Ping timeout: 248 seconds]
Guest70176 has joined #ruby
Rouge has quit [Ping timeout: 268 seconds]
<leitz> Okay, moved most of the failing tests into test/archive, added RickHull's stuff to the rakefile, and things work. So far.
guardianx has joined #ruby
<RickHull> hooray \o/
sepp2k has quit [Quit: Leaving.]
<weaksauce> progress... commit that and keep going
<weaksauce> you can always rebase later if you want to squash things
orbyt_ has joined #ruby
heinrich5991 has joined #ruby
Guest70176 has quit [Ping timeout: 248 seconds]
Psybur has quit [Ping timeout: 240 seconds]
jamiejackson has quit [Ping timeout: 248 seconds]
* leitz goes to feed the beasts and stretch his legs for a few minutes.
QualityAddict has quit [Quit: Leaving]
volty has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
troys is now known as troys_
Algebr has joined #ruby
troys_ is now known as troys
<Algebr> I have a OpenSSL::X509 object and when I do .to_s, it gives me the PEM format of the cert, but I want a p12 style format. any quick easy ways?
Rouge has joined #ruby
qu1j0t3 has left #ruby ["WeeChat 0.4.3"]
mtkd has quit [Ping timeout: 248 seconds]
mtkd has joined #ruby
webguynow has quit [Ping timeout: 240 seconds]
hays has joined #ruby
hays has quit [Changing host]
hays has joined #ruby
webguynow has joined #ruby
kitsunenokenja has joined #ruby
Anaasaa has joined #ruby
<Algebr> oh nvm, figured it out
milardov_ has joined #ruby
eckhardt has joined #ruby
milardov_ has quit [Client Quit]
rwb has joined #ruby
Puffball has quit [Remote host closed the connection]
milardovich has quit [Ping timeout: 240 seconds]
ShekharReddy has quit [Quit: Connection closed for inactivity]
biberu has quit []