baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview2: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has joined #ruby
jcarl43 has quit [Quit: WeeChat 2.2]
ams__ has quit [Quit: Connection closed for inactivity]
madhatter has quit [Ping timeout: 244 seconds]
heinrich5991 has quit [Ping timeout: 245 seconds]
jokke1 has quit [Ping timeout: 252 seconds]
heinrich5991 has joined #ruby
madhatter has joined #ruby
heinrich5991 has quit [Client Quit]
madhatter has quit [Ping timeout: 240 seconds]
madhatter has joined #ruby
graphene has quit [Remote host closed the connection]
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
graphene has joined #ruby
madhatter has quit [Ping timeout: 240 seconds]
jokke1 has joined #ruby
madhatter has joined #ruby
graphene has quit [Read error: Connection reset by peer]
graphene has joined #ruby
orbyt_ has joined #ruby
jokke1 has quit [Ping timeout: 252 seconds]
madhatter has quit [Ping timeout: 244 seconds]
jokke1 has joined #ruby
lxsameer has joined #ruby
heinrich5991 has joined #ruby
lxsameer has quit [Ping timeout: 252 seconds]
tpendragon has joined #ruby
elphe has quit [Ping timeout: 272 seconds]
heinrich5991 has quit [Quit: quit.]
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
Tempesta has joined #ruby
gnufied has quit [Quit: Leaving]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
geckos has joined #ruby
<geckos> I just installed rails gem but didn't get the raisl command
<geckos> I'm on Fedora
<geckos> I was expecting ~/.gem/ruby/bin to exists, but it doesn't
AJA4350 has quit [Quit: AJA4350]
<havenwood> geckos: How'd you install rails?
<havenwood> geckos: Did you?: gem install rails
<geckos> yeap
<havenwood> geckos: What's your $GEM_HOME?
<havenwood> geckos: printenv GEM_HOME
<geckos> empty
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<geckos> opts
<havenwood> geckos: What do you get for?: gem env gemdir
<havenwood> geckos: How about?: which -a rails
<geckos> ~/.gem/ruby
<geckos> which: no rails ...
<geckos> I was using ruby from distro packages
<havenwood> geckos: How about?: gem which rails
<geckos> Should I try rvm?
<havenwood> geckos: What package? Just curious.
<havenwood> geckos: I mean, what distro?
<geckos> /home/dhilst/.gem/ruby/gems/railties-5.2.1/lib/rails.rb
<geckos> Fedora
<havenwood> geckos: ah, nice
kapil___ has joined #ruby
<havenwood> geckos: Is there a?: /home/dhilst/.gem/ruby/bin/rails
<geckos> nope
<geckos> no ~/.gem/ruby/bin :-/
<geckos> weird
<havenwood> geckos: Still the same after a?: gem pristine rails
<geckos> didnt try pristine
<geckos> no bin, even after pristine
<havenwood> geckos: Normally there's be a: "$(gem env gemdir)/bin/rails"
<havenwood> there'd*
<havenwood> geckos: sec, sanity checking on Fedora
<geckos> I'll remove ruby form Fedora and install it with rvm
<havenwood> geckos: Or ruby-install + chruby should suffice.
<havenwood> geckos: Development or prod?
<havenwood> geckos: So odd the Rails binary isn't showing up...
<geckos> development
<havenwood> geckos: Anything odd in?: gem env
<havenwood> geckos: What is the?: EXECUTABLE DIRECTORY
<havenwood> gem env | grep "EXECUTABLE DIRECTORY"
<havenwood> geckos: Any odd settings under "GEM CONFIGURATION"?
<geckos> ^ gem env
<havenwood> Ah! /home/dhilst/bin
<havenwood> geckos: Is there a?: /home/dhilst/bin/rails
<geckos> There it is!
<geckos> THANKS!
<havenwood> geckos: np!
<geckos> Would this be a Fedora trap?
<havenwood> geckos: If you feel like having it be the expected dir, you could: export GEM_HOME="$HOME/.gem/ruby"
<havenwood> geckos: On my install, the EXECUTABLE DIRECTORY is: /usr/bin
<havenwood> geckos: Oh, I'm root at the moment.
<havenwood> So yeah. :-P
<geckos> Are you on Fedora too?
<geckos> zsh?
<havenwood> geckos: I hopped onto Fedora to sanity check. I usually do use zsh.
SeepingN has joined #ruby
<havenwood> geckos: But yeah, no issue here with dnf Ruby with Fedora and zsh.
<havenwood> geckos: which rails #=> /usr/local/bin/rails
<havenwood> geckos: I have in my gem env: "gem" => "--install-dir=/usr/local/share/gems --bindir /usr/local/bin"
<havenwood> geckos: Dunno why our Fedoras are configured differently.
<havenwood> geckos: If you wanted to, you could: echo '"gem" => "--install-dir=/usr/local/share/gems --bindir /usr/local/bin"' >> "$HOME/.gemrc"
<geckos> I my messed everything up. I didn't even remeber when I installed this ruby
<havenwood> geckos: Though my setup assumed root user >.>
<havenwood> geckos: I don't usually use Fedora, but I do like it!
<geckos> Cam you: rpm -qf `which ruby` ?
<havenwood> geckos: rubypick-1.1.1-9.fc29.noarch
<geckos> Same here, thanks!
<havenwood> de nada
<geckos> I usually use Linux
<geckos> eita, br detectado
<geckos> :D
moei has quit [Ping timeout: 252 seconds]
thy0 has quit [Quit: TTFN]
geckos has quit [Quit: Page closed]
orbyt_ has joined #ruby
dviola has joined #ruby
Nilium has quit [Ping timeout: 244 seconds]
braincrash has quit [Quit: bye bye]
zhustec has joined #ruby
dviola is now known as Guest46189
Guest46189 has quit [Ping timeout: 252 seconds]
braincrash has joined #ruby
dviola has joined #ruby
Xeago_ has joined #ruby
Xeago has quit [Ping timeout: 246 seconds]
Xeago_ is now known as Xeago
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
elphe has joined #ruby
dviola has quit [Ping timeout: 252 seconds]
eckhardt has joined #ruby
jdawgaz has joined #ruby
jdawgaz has quit [Client Quit]
duderonomy has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
ciro has joined #ruby
jdawgaz has joined #ruby
cliluw has joined #ruby
tdy has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
tdy has quit [Ping timeout: 246 seconds]
bkxd has joined #ruby
Azure has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
bkxd has left #ruby [#ruby]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
moei has joined #ruby
im0nde has quit [Ping timeout: 252 seconds]
ivanskie has joined #ruby
im0nde has joined #ruby
lytol_ has quit [Remote host closed the connection]
weaksauce has quit [Ping timeout: 246 seconds]
tdy has joined #ruby
reber has joined #ruby
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
jdawgaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fredlinhares has joined #ruby
fredlinhares has quit [Quit: WeeChat 1.4]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy has quit [Ping timeout: 245 seconds]
reber has quit [Remote host closed the connection]
Nilium_ has joined #ruby
Nilium_ is now known as Nilium
Nilium has quit [Read error: Connection reset by peer]
Nilium has joined #ruby
Dbugger has joined #ruby
sauvin has joined #ruby
RougeR has quit [Ping timeout: 252 seconds]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
MoritaShinobu has joined #ruby
akem has quit [Remote host closed the connection]
lomex has joined #ruby
darkhanb has joined #ruby
s2013 has joined #ruby
dellavg_ has joined #ruby
ShekharReddy has joined #ruby
duderonomy has joined #ruby
_whitelogger has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
MoritaShinobu has quit [Quit: Leaving]
zhustec has quit [Remote host closed the connection]
clemens3_ has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
xfbs has joined #ruby
zhustec has joined #ruby
yohji has joined #ruby
xfbs has quit [Quit: byebye]
xfbs has joined #ruby
clemens3_ has quit [Remote host closed the connection]
doubledup has joined #ruby
doubledup has quit [Max SendQ exceeded]
Mike11 has joined #ruby
doubledup has joined #ruby
zhustec has quit [Read error: Connection reset by peer]
MoritaShinobu has joined #ruby
sameerynho has joined #ruby
sticaz has joined #ruby
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lomex has joined #ruby
elphe has quit [Ping timeout: 252 seconds]
lomex has quit [Client Quit]
lomex has joined #ruby
lomex has quit [Client Quit]
Puffball has quit [Remote host closed the connection]
desperek has joined #ruby
rippa has joined #ruby
dionysus70 has joined #ruby
justinweiss has quit [Ping timeout: 272 seconds]
ShekharReddy has quit [Quit: Connection closed for inactivity]
furrymcgee has left #ruby [#ruby]
elphe has joined #ruby
Yxhuvud has quit [Remote host closed the connection]
elphe has quit [Ping timeout: 272 seconds]
sticaz has quit [Quit: sticaz]
conta has joined #ruby
Mike11 has quit [Quit: Leaving.]
apg has joined #ruby
<apg> Hi, how do you prevent a map from returning an item that is taken from a range on Ruby?
yohji has quit [Remote host closed the connection]
<apg> for example a = 1.upto(Float::INFINITY).lazy.map{|x| x}.first(24), I do not want to add x % != 0
lomex has joined #ruby
mitescugd has left #ruby ["C-x k"]
cd has quit [Quit: cd]
Mike11 has joined #ruby
bhaak has quit [Ping timeout: 252 seconds]
tristanp has joined #ruby
Puffball has joined #ruby
n13z has joined #ruby
tristanp has quit [Ping timeout: 252 seconds]
bhaak has joined #ruby
<apeiros> apg: I don't understand your question. part of that is `x % != 0` seems to be missing something
<apeiros> I'd assume the answer is to add a select before or after the map
dionysus70 has quit [Ping timeout: 272 seconds]
AJA4350 has joined #ruby
leitz has joined #ruby
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RougeR has joined #ruby
elphe has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
elphe has quit [Ping timeout: 252 seconds]
<apg> Sorry, I was mistyped
<apg> I mistyped
<leitz> apg, I missed it, so we're good. :)
<apg> apeiros, thanks. I ended up using select
apg has quit [Quit: Leaving]
Xeago_ has joined #ruby
Xeago has quit [Ping timeout: 252 seconds]
Xeago_ is now known as Xeago
<leitz> What makes you decide "class" versus "OpenStruct"?
_whitelogger has joined #ruby
amelliaa has joined #ruby
postmodern has quit [Quit: Leaving]
thy0 has joined #ruby
conta has quit [Quit: conta]
elphe has joined #ruby
yohji has joined #ruby
<apeiros> leitz: simple for me - openstruct only at drafting stage.
jdawgaz has joined #ruby
<leitz> apeiros, for me that may be an eternity. I've been trying to learn to code for a while. ;)
<leitz> In this case, I'm thinking of your comment about the character_tools mixin, and how the purpose for it seemed confusing.
<leitz> The "Character" class could be an Ostruct, there are only two or three "standard" methods the class would need, and they can be extracted to whatever class needs them.
<leitz> Since my view of "Character" is fairly organic, OStruct might be better.
jdawgaz has quit [Ping timeout: 272 seconds]
roshanavand has joined #ruby
<apeiros> leitz: can you enumerate the properties a character has?
kapil___ has joined #ruby
<leitz> apeiros, "enumerate" as in "explain" or as in "is enumerable"?
<apeiros> the latter
<apeiros> as in "is it a finite number of properties?"
<leitz> Ah, then depending on use case, no.
Azure has quit [Ping timeout: 272 seconds]
<leitz> It is a limited number of properties, but different use cases add properties while usually using the core set or properties.
sameerynho has quit [Ping timeout: 246 seconds]
brianj has joined #ruby
<brianj> Is this the right channel to ask for help on factoryBot and associations ? There is no #factorybot channel.. :-/
FernandoBasso has joined #ruby
<apeiros> brianj: sure. chances might be better over in #rubyonrails, though, since I'd assume factorybot is most often used in conjunction with rails
<brianj> apeiros: ill try there, thanks
<apeiros> leitz: "needs to be able to add properties defined by the end user", ok, that qualifies as infinite
<apeiros> personally I'd still not use ostruct, but ostruct would work
<leitz> The issue I have is the ability to add properties that are undefined.
<leitz> I pulled "Character_Tools" out of "Character" because the tools are only used on creation, not on presentation.
<leitz> Having them combined made for a huge class definition.
<leitz> How would you set the Character class up to add properties not in the original class?
<apeiros> you'd want to avoid collisions, so I'd go via a proxy. i.e. some_character.first_name (as an example for any predefined property), and some_character.custom.userdefined_proprty_here
<apeiros> and for custom, you could use openstruct. (class Character; def initialize; @custom = OpenStruct.new; …)
<leitz> At the moment there are two sets of properties: "Base + Usual" and "Leitz's Expanded which includes Base + Usual".
<leitz> Ah, so the base Character has a "@custom" property?
<apeiros> yes
lomex has joined #ruby
<leitz> Would you put the "standard" generation methods in the base class? There are a couple dozen of them. Less if the @custom stuff is pulled out.
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #ruby
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
desperek has quit [Quit: xoxo]
jackrandom has quit [Quit: ZNC - https://znc.in]
jackrandom has joined #ruby
brianj has quit [Remote host closed the connection]
ZzZombo_ has joined #ruby
beefjoe has joined #ruby
ZzZombo has quit [Ping timeout: 250 seconds]
ZzZombo_ is now known as ZzZombo
yohji has quit [Remote host closed the connection]
thy0 has quit [Ping timeout: 246 seconds]
amelliaa has quit [Quit: -]
elphe has quit [Ping timeout: 252 seconds]
ShekharReddy has joined #ruby
beefjoe has quit [Remote host closed the connection]
<apeiros> leitz: sorry, missed your last question. not sure what you understand as "generation methods". but sounds like something which might be class methods.
RougeR has quit [Ping timeout: 245 seconds]
jgpawletko has joined #ruby
<leitz> apeiros, no worries. Class Character can either take an existing hash and convert it to a Character, or it can take an empty hash and generate the data. For the "standard" use of the class, should the generation methods go into the base class? Those things all Characters have?
<apeiros> if I understand you correctly, then yes, those should be class methods of the base class.
thy0 has joined #ruby
<leitz> Okay, i'm working on understanding it. Slowly...
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
ZzZombo has quit [Quit: Going offline, see ya! (www.adiirc.com)]
cagomez has joined #ruby
ZzZombo has joined #ruby
ciro has quit [Quit: WeeChat 2.2]
<leitz> apeiros, this is what I have so far. https://gist.github.com/LeamHall/d5aed9d0f1cfa0f55e74967310e90d66
<leitz> Critique?
<apeiros> generate belongs into class level (and parts of the code probably into a separate class even)
<apeiros> iirc, upp is a specific set of attributes, I wouldn't use a hash for that. at the very least a struct. and I wouldn't allow manipulation of it by replacing the full hash either (the upp= method)
<apeiros> ah, and stylistic thing: requires belong to the top of the file. even before opening the class.
<leitz> The "separate class" for generate was most of what "Character_Tools" did, I thought you recommended it be in the class?
<apeiros> the only reason I could imagine to recommend keeping it in the same class would be as a temporary thing to grow your code.
<apeiros> as far as I understand your problem domain, generation of characters will become rather complex. keeping that in the same class will put too many responsibilities in the same place.
<leitz> If the generation is pulled out then there are no real methods in the Character class. So back to an Ostruct.
Azure has joined #ruby
<leitz> There's a Presenter for different output styles, and I'm building stuff to input from CSV and JSON.
<apeiros> I'm pretty sure there's plenty of things one can do with a character which belong into that class. I doubt it'd just be a data container.
elphe has joined #ruby
<apeiros> also providing methods which connect it with generators and presenters can be worthwhile. it means you have a clear and understandable hub.
<apeiros> i.e. while you'd have something like Character::Generator, Character::JsonPresenter etc., you'd still use them via Character::generate and Character#to_json
elphe has quit [Ping timeout: 246 seconds]
johnny56 has quit [Ping timeout: 272 seconds]
lomex has joined #ruby
elphe has joined #ruby
johnny56 has joined #ruby
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
elphe has quit [Ping timeout: 244 seconds]
cagomez has quit [Ping timeout: 264 seconds]
elphe has joined #ruby
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elphe has quit [Ping timeout: 264 seconds]
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
desperek has joined #ruby
elphe has joined #ruby
elphe has quit [Ping timeout: 244 seconds]
cagomez has joined #ruby
DTZUZU has quit [Quit: WeeChat 1.9]
beefjoe has joined #ruby
MoritaShinobu has quit [Ping timeout: 246 seconds]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
FernandoBasso has quit [Remote host closed the connection]
cagomez has quit [Ping timeout: 252 seconds]
elphe has joined #ruby
segy has quit [Quit: ZNC - http://znc.in]
elphe has quit [Ping timeout: 272 seconds]
MoritaShinobu has joined #ruby
yohji has joined #ruby
yohji has quit [Remote host closed the connection]
segy has joined #ruby
beefjoe has quit [Remote host closed the connection]
Yxhuvud has joined #ruby
elphe has joined #ruby
ShekharReddy has quit [Quit: Connection closed for inactivity]
elphe has quit [Ping timeout: 272 seconds]
sticaz has joined #ruby
orbyt_ has joined #ruby
tristanp has joined #ruby
tristanp has quit [Ping timeout: 250 seconds]
Puffball has quit [Remote host closed the connection]
elphe has joined #ruby
dviola has joined #ruby
elphe has quit [Ping timeout: 250 seconds]
elphe has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
dellavg_ has quit [Ping timeout: 272 seconds]
lomex has joined #ruby
tdy has joined #ruby
elphe_ has joined #ruby
elphe_ has quit [Ping timeout: 240 seconds]
tristanp has joined #ruby
darkhanb has quit [Ping timeout: 252 seconds]
elphe has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
elphe has joined #ruby
elphe has quit [Ping timeout: 245 seconds]
FernandoBasso has joined #ruby
jokester has quit [Ping timeout: 276 seconds]
Mike11 has quit [Quit: Leaving.]
reber has joined #ruby
elphe has joined #ruby
cschneid_ has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
jokester has joined #ruby
elphe has joined #ruby
cschneid_ has quit [Ping timeout: 252 seconds]
Eiam has quit [Ping timeout: 272 seconds]
elphe has quit [Ping timeout: 252 seconds]
FernandoBasso has quit [Remote host closed the connection]
graphene has quit [Remote host closed the connection]
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
graphene has joined #ruby
elphe has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
cd has joined #ruby
troulouliou_dev has joined #ruby
elphe has joined #ruby
yohji has joined #ruby
Puffball has joined #ruby
elphe has quit [Ping timeout: 252 seconds]
Azure has quit [Ping timeout: 252 seconds]
elphe has joined #ruby
troulouliou_dev has quit [Remote host closed the connection]
elphe has quit [Ping timeout: 244 seconds]
elphe has joined #ruby
tolland has joined #ruby
dviola has quit [Quit: WeeChat 2.2]
elphe has quit [Ping timeout: 246 seconds]
Puffball has quit [Read error: Connection reset by peer]
xfbs has quit [Read error: Connection reset by peer]
xfbs has joined #ruby
Puffball has joined #ruby
elphe has joined #ruby
elphe has quit [Ping timeout: 272 seconds]
troulouliou_dev has joined #ruby
MoritaShinobu has quit [Ping timeout: 244 seconds]
s2013 has joined #ruby
xfbs has quit [Quit: afk]
elphe has joined #ruby
xfbs has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elphe has quit [Ping timeout: 272 seconds]
jasmith has quit [Quit: Leaving]
sameerynho has joined #ruby
lomex has joined #ruby
<leitz> apeiros, do you know of some code that is structured like that? I'd love to take a look and learn.
conta has joined #ruby
doubledup has quit [Quit: Leaving]
thy0 has quit [Ping timeout: 246 seconds]
yohji has quit [Remote host closed the connection]
yohji has joined #ruby
elphe has joined #ruby
orbyt_ has joined #ruby
marz_d`ghostman has joined #ruby
elphe has quit [Ping timeout: 246 seconds]
<apeiros> eh, no. but I seem to remember that baweaver once wrote a reference implementation for what you wanted to do. he might have used that pattern.
<apeiros> (not really a pattern)
agent_white has quit [Quit: brb]
thy0 has joined #ruby
<marz_d`ghostman> I have a gem mygem-my_util, so in my lib is ./lib/mygem/my_util/util/util.rb How do I describe it in RSpec? I tried Mygem/::Myutil::util::util
Dbugger has quit [Ping timeout: 240 seconds]
<leitz> apeiros, I read baweaver's stuff, can't say that I understand it yet. I sort of scratch my head and say "Nice...I think." ;)
desperek has quit [Quit: xoxo]
kapil___ has quit [Quit: Connection closed for inactivity]
<havenwood> marz_d`ghostman: Kinda odd to have a `.../util/util.rb`. Usually you'd see `/lib/mygem/my_util/util.rb` maybe with `/lib/mygem/my_util/util/something_else.rb`.
graphene has quit [Read error: Connection reset by peer]
<havenwood> marz_d`ghostman: But if there were double utils, like you showed, it'd be: Mygem::MyUtil::Util::Util
<havenwood> marz_d`ghostman: The namespace should mirror the file and directory hierarchy.
<marz_d`ghostman> havenwood: the util.rb is the main class and the util folder will contain the main class along with any modules and classes that needs to be created
graphene has joined #ruby
<marz_d`ghostman> havenwood: Do I have to define a require somewhere? cause it's not working though
herbmillerjr has joined #ruby
<havenwood> marz_d`ghostman: Here's an example of a similar setup, with digest-sip_hash and Digest::SipHash: https://github.com/havenwood/digest-sip_hash
<havenwood> marz_d`ghostman: In your case, it should be: /lib/mygem/my_util/my_util.rb
<havenwood> marz_d`ghostman: Mygem::MyUtil
<havenwood> marz_d`ghostman: It's expected that there'l be a /lib/mygem/my_util/my_util.rb file.
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<marz_d`ghostman> It's giving me the error: uninitialized constant Rise::MirrorManager::Sync
<marz_d`ghostman> Tried adding require 'rise/mirror_manager', didn't help though
<havenwood> marz_d`ghostman: your dir structure looks good for: /lib/rise/mirror_manager/
<havenwood> marz_d`ghostman: And it properly then has a:L /lib/rise/mirror_manager.rb
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<havenwood> marz_d`ghostman: Why is sync.rb in a sync/ dir?
<havenwood> marz_d`ghostman: I'd expect that not to be nested.
s2013 has joined #ruby
<havenwood> marz_d`ghostman: /lib/rise/mirror_manager/sync.rb should correspond with Rise::MirrorManager::Sync
<marz_d`ghostman> havenwood: I'm assuming I'll be creating another class for sync purposes or a module perhaps. To organize it, I'll just have all sync related files inside the sync/ dir
<havenwood> marz_d`ghostman: Just like you have /rise/mirror_manager.rb and /rise/mirror_manager/, you'd have /rise/mirror_manager/sync.rb and /rise/mirror_manager/sync/*
<havenwood> marz_d`ghostman: But sync.rb doesn't belong in the sync/ dir, like mirror_manager.rb doesn't belong in the mirror_manager/ dir
<havenwood> marz_d`ghostman: sync.rb and sync/ should both be in /mirror_manager
lomex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> if you had a sync/brink.rb, it'd be Rise::MirrorManager::Sync::Brink - for example
yohji has quit [Remote host closed the connection]
thy0 has quit [Ping timeout: 272 seconds]
marz_d`ghostman has quit [Ping timeout: 252 seconds]
marz_d`ghostman_ has joined #ruby
<marz_d`ghostman_> havenwood: I see, so sync.rb should be under mirror_manager
<marz_d`ghostman_> havenwood: moved it, still having the erorr though
<havenwood> marz_d`ghostman_: In /lib/rise/mirror_manager.rb do you?: require 'mirror_manager/sync'
elphe has joined #ruby
<marz_d`ghostman_> havenwood: Oh, so I still have to. Then I'll require rise/mirror_manager on spec-helper
<marz_d`ghostman_> havenwood: Okay, did that, still now working
<havenwood> marz_d`ghostman_: Show the code?
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<marz_d`ghostman_> I have a require 'rise/mirror_manager' at the top of spec_helper.rb as well
elphe has quit [Ping timeout: 272 seconds]
thy0 has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
<havenwood> marz_d`ghostman_: Does sync_spec.rb require the spec_helper.rb?
<havenwood> marz_d`ghostman_: If the repo is public, it'd be way easier to look at the real code. If not, we could probably tell what the issue is with the requires from the relevant files.
conta has quit [Quit: conta]
<marz_d`ghostman_> havenwood: It does not
<havenwood> marz_d`ghostman_: The specs will probably each need to require the helper.
<marz_d`ghostman_> havenwood: How do I do that?
<havenwood> marz_d`ghostman_: With your current directory layout: require_relative '../../spec_helper'
<marz_d`ghostman_> havenwood: Haven't seen anything like that before though
<havenwood> marz_d`ghostman_: If you look around you'll see that test helpers are there to be required by the tests.
<havenwood> marz_d`ghostman_: I can link you to dozens of examples. But all it is is requiring the helper from your tests.
dviola has joined #ruby
<havenwood> marz_d`ghostman_: The other way is to setup LOAD_PATH and use require instead of require_relative.
<marz_d`ghostman_> havenwood: This one doesn't https://github.com/marzdgzmn/marz-rsync
<marz_d`ghostman_> havenwood: not the test, the specs
<marz_d`ghostman_> havenwood: I mean minitest and rspec looks on their corresponding dirs right?
<havenwood> marz_d`ghostman_: You have to require it, one way or the other.
<leitz> Hey havenwood, in your copious free time (!), can you look at: https://github.com/makhidkarun/ftl_chargen/blob/master/bin/chargen#L83-L87
<havenwood> marz_d`ghostman_: If you'd like to use the .rspec file to automagically require rather than require_relative, you can totally do that. It's less explicit.
<leitz> I haven't figured out how to use the careers in the module refactor.
<marz_d`ghostman_> havenwood: I tried adding a .rspec file still not working though
cschneid_ has joined #ruby
<havenwood> marz_d`ghostman_: I'd suggest explicit require_relative or carefully read RSpec's .rspec file docs.
<marz_d`ghostman_> havenwood: Okay, I'll give it a try thanks
<havenwood> marz_d`ghostman_: np
<havenwood> leitz: So you want to programatically iterate through eh classes that inherit from Career?
<havenwood> the*
* leitz thinks if havenwood's help was paid for in libations the poor guy would be drunk for years...
* havenwood hiccups
<leitz> havenwood, just one class. The program is called with "bin/chargen -c Navy"
<havenwood> leitz: ahh
nfk has joined #ruby
s2013 has joined #ruby
<havenwood> leitz: What goes wrong when you run ^ that?
<leitz> Though the career names are put in a list to check. So "bin/chargen -c PoorCoder" would default to a career based on the social standing (:soc) since there is no PoorCoder class.
<leitz> Yet.
<havenwood> leitz: Wouldn't capitalizing mess up PoorCoder?: https://github.com/makhidkarun/ftl_chargen/blob/master/bin/chargen#L84
<leitz> havenwood, it ignores the -c option. Lemme run it real quick and gist it.
<havenwood> >> 'PoorCoder'.capitalize
<ruby[bot]> havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<leitz> PooCoder....yeah, see where there's no class? :P
<havenwood> leitz: reading the surrounding code for context, sec
<havenwood> leitz: It looks like you're not adding careers to the options['careers'] when parsing options.
<havenwood> Oh, you're setting 0, hrm. What's that about?
<leitz> havenwood, correct. This broke when I moved things to FTLChargen module. Lemme go find the old code.
cschneid_ has quit [Ping timeout: 245 seconds]
<havenwood> Oh, you're using that as a kinda meta-data toggle?
<leitz> havenwood, Number of terms in that career.
<leitz> Each term ages the character 4 years, but background careers don't.
<leitz> havenwood, so a -t 5 means 20 years in that career.
<havenwood> leitz: So what's an example of it not working?
<leitz> havenwood, the careers hash might be {'Navy' => 2, 'Citizen' => 1 }
<havenwood> leitz: Oh, you gisted it
* leitz backspaces...
<leitz> havenwood, on Line 2 of the gist, "Citizen' is the career, based on Soc.
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<havenwood> leitz: Here you probably want to do something more like Rail's #underscore: https://github.com/makhidkarun/ftl_chargen/blob/master/bin/chargen#L83
LiftLeft has quit [Ping timeout: 250 seconds]
<havenwood> leitz: #downcase would only work for constants with a Single capital
<havenwood> leitz: Same problem with #capitalize here: https://github.com/makhidkarun/ftl_chargen/blob/master/bin/chargen#L84
<leitz> Not familiar with Rails. The careers are in a separate directory to allow the Array to be built from going over the names.
<marz_d`ghostman_> havenwood: got it working now, so every class I make I should prefix with a module Rise module MirrorManager
<havenwood> leitz: You'd want to use something like Rail's #camelize for the latter.
<leitz> havenwood, yeah, hadn't thought of mixed case, so far they are all capitalized.
<havenwood> marz_d`ghostman_: nice, yup
<marz_d`ghostman_> havenwood: thanks for the help man
<havenwood> leitz: Or #constantize.
marz_d`ghostman_ has quit [Quit: Page closed]
<havenwood> marz_d`ghostman_: you're welcome
<havenwood> leitz: You probably shouldn't dynamically require like this, if you can avoid it.
<havenwood> leitz: This line should handle the requires: https://github.com/makhidkarun/ftl_chargen/blob/master/bin/chargen#L10
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> leitz: lib/ftl_chargen.rb should require the careers, etc.
<leitz> havenwood, the idea was to allow others to write their own career files. Even have a document for it. :)
<havenwood> leitz: You can require everything in that directory in: ftl_chargen.rb
<leitz> havenwood, can you do it without specifying? That was a design goal, "just plop a career in".
<havenwood> leitz: Yes, in ftl_chargen.rb you can dynamically require each .rb file in that dir.
<havenwood> leitz: Sec, I can find a good example.
* leitz goes to google
<leitz> havenwood, this? Dir["/path/to/directory/*.rb"].each {|file| require file }
<havenwood> leitz: yup
<apeiros> .glob(path) { |file|
<apeiros> saves you a method call.
elphe has joined #ruby
<havenwood> leitz: apeiros' version I ^ is better
<havenwood> is*
* apeiros prefers explicit requires, though
<leitz> Should I require all careers even if only one will be used for a program run?
<havenwood> leitz: Probably.
alem0lars has joined #ruby
* leitz goes to code for a minute.
elphe has quit [Ping timeout: 252 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<leitz> havenwood, apeiros, added the Dir.glob on line 12. Line 88 is giving an uninitialized constant since the constant now has the module prefix. https://github.com/makhidkarun/ftl_chargen/blob/career_refactor/bin/chargen#L88
reber has quit [Remote host closed the connection]
<leitz> The module prefix is the issue I'm hitting. In the gist, "FTLChargen::Navy" wasn't found in the career array so the Soc was used to make a Citizen.
<apeiros> Dir.glob('../lib/ftl_chargen/careers') should be Dir.glob('ftl_chargen/careers', dir: "../lib")
<apeiros> curious you don't get an exception there
<apeiros> and yes, you do const_get on the module which contains the constant you want
<apeiros> which is almost never Module btw., toplevel is Object.
<apeiros> btw., don't call srand
LiftLeft has joined #ruby
<leitz> apeiros, this "Dir.glob('ftl_chargen/careers', dir: "../lib") {|file| require file }" gives "in `glob': unknown keyword: dir (ArgumentError)"
s2013 has joined #ruby
<leitz> Why not use srand?
<leitz> apeiros, on the "const_get", it used to work before moving everything to the module.
<apeiros> leitz: don't call srand because ruby does that on its own already
<apeiros> sorry, base:, not dir: in glob
<apeiros> and const_get worked coincidentally, not because it was correct :-p
<leitz> apeiros, okay, base works. And I'm a pragmatic guy; "works" is "correct". :)
<apeiros> but I see now that you construct the full constant name. Object.const_get("Full::Constant::Path") will work, if it doesn't, it means you either haven't loaded the code which defines the constant yet, or you constructed the name wrong.
<apeiros> incorrect pragmatism a) will bite you, b) means that you'll not be able to grow, since growing requires a working foundation
<apeiros> (not be able is too harsh - but it'll certainly limit)
<leitz> Harsh is okay, given the amount of help you're providing. :)
cschneid_ has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<leitz> apeiros, I'm missing how to format the Object.const_get. Tired to remove each section and it still errors. https://github.com/makhidkarun/ftl_chargen/blob/career_refactor/bin/chargen#L87-L91
<leitz> uninitialized constant FTLChargen::Careers (NameError)
<apeiros> well, do you require the file where that constant is defined?
<apeiros> you should probably test what `Dir.glob('../lib/ftl_chargen/careers')` and `Dir.glob('ftl_chargen/careers', base: "../lib")` return
<apeiros> (will be the same as what it yields, but easier to test)
orbyt_ has joined #ruby
xfbs has quit [Ping timeout: 240 seconds]
<leitz> Hmm...changing "require" to "puts" gives nothing. Poking it some more.
cschneid_ has quit [Ping timeout: 272 seconds]
<apeiros> your glob expression is wrong
<apeiros> in your case, you'll probably want a **/*.rb at the end
roshanavand has quit [Ping timeout: 272 seconds]
armyriad has quit [Read error: Connection reset by peer]
armyriad has joined #ruby
<leitz> apeiros, Dir.glob("ftl_chargen/careers/*.rb", base: "lib/") {|file| require file }
<apeiros> and which file defines FTLChargen::Careers?
<apeiros> also an important note: having your requires relative to the working directory is a *terrible* idea.
<apeiros> at the very least make it relative to the currently executed file.
<leitz> At the moment I'm focused on the one issue. Even requiring the files doesn't resolve it.
Pisuke has quit [Ping timeout: 246 seconds]
<apeiros> 00:10 apeiros: and which file defines FTLChargen::Careers?
Sembei has joined #ruby
<leitz> None.
<leitz> Interesting, may have it. Not sure why.
<apeiros> weeeeell, if no file defines that constant, obviously you'll get NameError: uninitialized constant
<apeiros> from the name, which file *should* define it?
<leitz> Yup. so the solution is to remove "Careers" since it was never created as a module/namespace.
<apeiros> nooooo
<apeiros> well, ok, *maybe*.
<hays> I am trying to simply scope a function to a module. what is the way to do this so that its seen within classes of that module
kapil___ has joined #ruby
<apeiros> it may not be the right solution, though
<apeiros> hays: when you say "scope", what do you understand by that?
<hays> i tried self.fun and that doesn't seem to be in scope
<hays> i can call the function without any references to the module
<leitz> apeiros, it's the level I can understand at the moment.
<leitz> hays, you're in good hands!
<apeiros> leitz: you should still try to answer the question which file should define FTLChargen::Careers, because understanding that is quite crucial.
<apeiros> because the mapping between module/class constants and files *should* be 1:1
* baweaver wanders in
<apeiros> hays: ruby doesn't do that at all.
<apeiros> hays: what you can do is define the myfoo method in a module and use `include ThatModule` in your class DEF, and then you can use myfoo in DEF.
<apeiros> but nesting namespaces are never considered for method lookup.
<apeiros> only inheritance.
elphe has joined #ruby
<leitz> Hey baweaver, your name was used in vain earlier.
<leitz> I think havenwood wandered off drunk.
sameerynho has quit [Ping timeout: 272 seconds]
<leitz> apeiros, i think the mapping is 1:1, but the Careers namespace is not defined.
<leitz> That is, each career establishes one Constant.
elphe has quit [Ping timeout: 240 seconds]
<apeiros> leitz: so then answer the question :) which file *should* define FTLChargen::Careers
<hays> hmm.. ok. i think i can live with that
<leitz> apeiros, and that goes back to the dynamic nature of the career files. On the off chance anyone else ever uses this, I wanted added a career to be easy.
* leitz smiles since his tests also pass.
Emmanuel_Chanel has quit [Quit: Leaving]
<apeiros> leitz: no. it does not go back to the dynamic nature. there is one clear file which should define FTLChargen::Careers. you can infer it directly from the constant name.
graphene has quit [Read error: Connection reset by peer]
graphene has joined #ruby
ellcs has joined #ruby
<apeiros> leitz: with your naming style, the rule is simple: downcase and replace :: with /. so FTLChargen::Careers is ftlchargen/careers, so lib/ftlchargen/careers.rb
<apeiros> leitz: from that also follows that if you have lib/ftlchargen/careers/somejob.rb, then that should define FTLChargen::Careers::Somejob
<apeiros> sidenote though: FtlChargen::Careers --> ftl_chargen/careers.rb is nowadays the preferred style (stems from rails). simply because it allows the mapping to be bijective.
<leitz> apeiros, I think I see what you mean. However, there's another issue to fix that's related, it seems. I'm getting "circular requires" and want to fix that before doing any more requires.
<apeiros> circular requires are not an issue.
<leitz> They are killing the Travis tests.
<apeiros> o0
<apeiros> how?
<apeiros> lolwut
<leitz> hmm...should not call ftl_tools. Gimme a sex.
<apeiros> absolutely not :-p
<leitz> sec...ARGGGHHH!!!!
<apeiros> sorry leitz, I just don't find you that attractive ;-)
<leitz> Me neither.
<leitz> Of course, if havenwood is drunk enough...
<apeiros> shh, we don't talk about that incident.
<leitz> Which one?
<apeiros> exactly.
<leitz> Okay, travis passes now. I would still like to get rid of the circular require because it's bad form.
<leitz> In theory (a big word), character_tools should not require anything. It should just be mixed in to Character.
<leitz> In practice...
<apeiros> na, somebody at travis needs a serious talking to.
<apeiros> that warning is bull.
<leitz> It comes up in rake, too.
<leitz> Sorry, my rake file just runs tests.
<apeiros> I guess I have to run my code with -w again, might come from there, not travis itself. it's still bull.
<leitz> I'm still chuckling at it being confused about assigned but unused variables. The assignment is the use.
thy0 has quit [Ping timeout: 246 seconds]
cschneid_ has joined #ruby
<leitz> Okay, I have some duplicate defs to clean up. While you're awake though. you're saying I should make lib/ftl_chargen/careers.rb do the mass require and put the careers into a Career namespace inside FTLChargen?
alem0lars has quit [Ping timeout: 272 seconds]
Emmanuel_Chanel has joined #ruby
<apeiros> in my old style, I'd require everything I need in every file. for the slight special case of careers/*.rb being dynamic, I'd do a glob require in careers.rb, yes.
elphe has joined #ruby
<leitz> So take the Dir.glob and put it there, and then just require ftl_chargen/careers?
agent_white has joined #ruby
<apeiros> yopp
* leitz goes to break more stuff.
* apeiros goes to rewrite Pawn#checkMove (in JS)
<baweaver> was about to say, apeiros
graphene has quit [Remote host closed the connection]
<baweaver> you're going down a dark path
<baweaver> :P
<apeiros> wat, y?
<apeiros> pawn movement is actually unexpectedly complex. until I started this coding exercise with my wife, I never knew about "en passant" move of the pawn.
graphene has joined #ruby
<baweaver> checkMove
<baweaver> camels O_O
* leitz really needs to fix these circular requires.
<apeiros> aaah, heh, yes. javaScript. much camel.
<apeiros> quite honestly, this trips me up quite a bit. ruby_variables, javaScript and css-classes
cschneid_ has quit [Ping timeout: 272 seconds]
<apeiros> oh, and of course #css_ids, just because…
<leitz> What's the best way to fix the direct directory reference? https://github.com/makhidkarun/ftl_chargen/blob/master/bin/chargen#L25-L32
thy0 has joined #ruby
<apeiros> leitz: __dir__
<apeiros> that one is relative to the script file. though, don't use that in the executable.
<apeiros> while lib will usually stay together, bin & lib might not be put in the same dir during installation.
<leitz> I was using the load path.
graphene has quit [Remote host closed the connection]
<apeiros> ah, that's even better.
* leitz goes back to breaking stuff.
graphene has joined #ruby
cschneid_ has joined #ruby
<leitz> Okay, I'm done for the day. Thanks for the help apeiros! When havenwood sobers up, tell him thanks too.
graphene has quit [Read error: Connection reset by peer]
graphene has joined #ruby
white_lilies has joined #ruby
cschneid_ has quit [Ping timeout: 245 seconds]
ellcs has quit [Ping timeout: 264 seconds]
leitz has quit [Quit: Leaving]
graphene has quit [Remote host closed the connection]
graphene has joined #ruby
s2013 has joined #ruby
cschneid_ has joined #ruby