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
Technodrome has joined #ruby
Algebr has quit [Read error: Connection reset by peer]
Algebr has joined #ruby
nofxx has quit [Remote host closed the connection]
<RickHull> leitz: move the require above the class
<RickHull> and it looks like you're no longer `include`ing your mixin
nofxx has joined #ruby
<RickHull> remember: require takes a filename and makes the definitions within available
<RickHull> include takes a module object and injects the module into the current context
cdg has quit [Remote host closed the connection]
alveric3 has joined #ruby
<RickHull> leitz: though we can start doing some restructuring
<leitz> That worked. Once I checked how to re-include. Still have a Noble hiding somewhere. Off to kill her.
<RickHull> most of the #generate methods don't need to be instance methods
<RickHull> most, if not all
alveric2 has quit [Ping timeout: 255 seconds]
<RickHull> do you have the latest committed?
<leitz> Do now.
<leitz> :)
<leitz> Something can't find the career files. Trying to fix that. It isn't saying where the issue is.
kryptoz has joined #ruby
mikecmpb_ has joined #ruby
volty has quit [Quit: Konversation terminated!]
mikecmpbll has quit [Ping timeout: 252 seconds]
<RickHull> here's how I would write generate_upp https://gist.github.com/rickhull/d7e0c2845c3b7587aaf370569c5df6d3
<RickHull> notice it's defined on the Character class, in character.rb
<RickHull> it's a "class method" rather than an "instance method" as it does not touch the Character object's ivars
<RickHull> `class Foo; `def self.bar` defines a class method that can be called like `Foo.bar`
<RickHull> without instantiating an object
<RickHull> i left an extra backtick in there, oops
jackjackdripper has joined #ruby
<dminuoso> A keen reader might notice that strictly speaking it is an instance method, but its tied to "self" (which in the context is the class object itself) -> which is why Character.generate_upp works. You call methods on instances.
<RickHull> sure, I mean in general OOP terminology, not ruby's weird twisted mirror of mirrors clownhouse
jackjackdripper1 has quit [Ping timeout: 248 seconds]
<dminuoso> >> a = "RickHull"; def a.hi; puts "hi, I am: #{self}"; a.hi
<ruby[bot]> dminuoso: # => /tmp/execpad-4f771f7cf4d1/source-4f771f7cf4d1:7: syntax error, unexpected end-of-input, expecting ke ...check link for more (https://eval.in/905705)
<dminuoso> >> a = "RickHull"; def a.hi; puts "hi, I am: #{self}"; end; a.hi
<ruby[bot]> dminuoso: # => hi, I am: RickHull ...check link for more (https://eval.in/905706)
<dminuoso> Sucks so muchy to type in irssi without an editor completing your `end` all the time.
<leitz> Hang on a sec, the chargen is broken.
<RickHull> i think a lot of my lack of grokking ruby's metaclass stuff has to do with devouring one of the earliest versions of Pickaxe
<RickHull> which explained things in conventional terms -- and I locked into that understanding
<dminuoso> RickHull: Dont even have to talk about all that stuff. You can think of it as defining methods on objects rather than classes.
<RickHull> classes are objects
<RickHull> so uh, boosh
<dminuoso> Yup.
<RickHull> it makes things terribly annoying to discuss
<dminuoso> RickHull: My point is, they are not "special to classes". You can tie a method to anything by just using def foo.bar :)
<dminuoso> The fact that there's classes involved, that is probably the secret bit we dont have to talk about.
Psybur has joined #ruby
<dminuoso> RickHull: This is also a good reason to not talk about `class << a` (notice how I intentionally did not use `self` there?) because the entire syntax should make you question "what is going on here. what is the keyword class doing here?"
<dminuoso> >> class << "funny business"; def fun; end; end
<ruby[bot]> dminuoso: # => :fun (https://eval.in/905707)
<RickHull> yeah that syntax is inscrutable
<dminuoso> Its great if you understand that it just opens up an objects singleton class. ;-)
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RickHull> I've worked with folks that love doing that, just so they can omit the `self` part of `def self.foo`
<dminuoso> class << a; end; is basically equivalent to a.singleton_class.instance_eval do; end
<RickHull> that's a horrendous use of coding judgment IMHO
<dminuoso> RickHull: I sometimes do it out of convenience.
<dminuoso> But its rare and usually justified.
exhiled has joined #ruby
<RickHull> omitting a tiny part of a major signifier of what the method is intended for
<RickHull> WHY!?!?!?
<RickHull> and using goofball syntax to do it
<dminuoso> RickHull: Since my time with Haskell Ive started to appreciate concise syntax.
<RickHull> like, it's a big deal in my world whether a method is a "class method" or an "instance method"
<RickHull> how much does typing `self` hurt? I love looking at it -- it means something
<dminuoso> The frustration you are talking about, I had it too. I ended up realizing, it was mostly due to a lack of exact understanding.
cschneid_ has quit [Remote host closed the connection]
<RickHull> i'd prefer your instance_eval version
Psybur has quit [Ping timeout: 248 seconds]
<RickHull> but why even go there? you're adding a whole layer of indentation and masking the method signature
<RickHull> WHY?!
<dminuoso> RickHull: Note there's probably some subtly difference in semantics.
cschneid_ has joined #ruby
<weaksauce> tomfoolery is why
<RickHull> why should I even have to consider a semantic difficulty?
<RickHull> WHY?!
<dminuoso> RickHull: At any rate. The day I learned that ruby had no class methods, was when ruby was finally demystified. I wished that articles and guides had mentioned this everywhere.
<RickHull> there are methods that have no access to ivars
<dminuoso> RickHull: Maybe you should start writing in SKI calculus.
<dminuoso> Only three things to consider.
<RickHull> and can be called without instantiating anything
<RickHull> and are globally available with `require`
<RickHull> "class methods" kick ass
<RickHull> what do you call them?
<dminuoso> methods.
<RickHull> do you distinguish between methods that mess with ivars and require an instantiated object to call?
<dminuoso> the only difference between some method and another, is their name and/or the class/module they are defined in.
<RickHull> and those that don't?
<dminuoso> huh?
<dminuoso> what makes you think methods on singleton classes cant have instance variables?
<dminuoso> and what makes you think you dont require an instantiated object to call them?
<dminuoso> Array.class << Array is an instantiated object, is it not?
knight33 has joined #ruby
<RickHull> i don't quite follow. I mean where a user calls .new
cschneid_ has quit [Ping timeout: 240 seconds]
<RickHull> File.open(fn) vs File.new(fn).open
<weaksauce> i don't know if that distinction is worth making dminuoso
<RickHull> clearly one versions doesn't require instatiating a file
<weaksauce> Array is a special object
<dminuoso> >> def Class.store(a); @storage = a; end; def Class.print; puts @storage; end; Class.store(1); Class.print
<ruby[bot]> dminuoso: # => 1 ...check link for more (https://eval.in/905715)
<leitz> The intent is that chargen pulls in all possible careers from the lib/careers directoyr.
<leitz> It worked before I starting blowing things up.
<dminuoso> RickHull: Like I said. There is no such thing as class methods. There is only methods. ;-)
guardianx has quit []
<RickHull> dminuoso: that's beautifully nonresponsive :|
hays_ has joined #ruby
<dminuoso> RickHull: The example is a bit ill-conceived.
<dminuoso> You are creating objects eithe rway.
<dminuoso> It's just two different approaches.
mim1k has joined #ruby
<RickHull> sure, and one is goofballs
<RickHull> guess which
<weaksauce> leitz where is that file?
<dminuoso> RickHull: Im unsure what your point is.
hays has quit [Ping timeout: 240 seconds]
<weaksauce> if you want to do something like that you would need to add an umbrella file that contains requires to all the other career files.
<leitz> weaksauce, which file?
<weaksauce> careers.rb
<al2o3-cr> >> class X def self.x() :x end end; X.singleton_class.instance_methods(false)
<ruby[bot]> al2o3-cr: # => [:x] (https://eval.in/905718)
<weaksauce> sorry, career.rb
<leitz> It's not. This is the tricky part I mentioend a while ago. "career" is from line 72, a variable.
troys is now known as troys_
<RickHull> weaksauce: the career being required -- that's a variable, not 'career'
<weaksauce> oh right. my bad
<leitz> So it refers to noble, other, etc.
<RickHull> require career -- vs -- require 'career'
<leitz> weaksauce, I wrote it and I still barely get it...
<leitz> Of course, I wrote it with #ruby help. :)
<weaksauce> you'd want to use the full path to that file.
<leitz> The issue is, I think, once LOAD_PATH is not modified, it can't find it.
mim1k has quit [Ping timeout: 248 seconds]
<leitz> I tried to add the path but it didn't work "careers/#{career}"
<RickHull> i think you need require File.join('careers', career)
<RickHull> yes, you need to provide the subdir path within lib/
<weaksauce> so if your key is noble. the filename is noble.rb and then the require should be something like require "lib/careers/#{career}"
<RickHull> not with lib though
<weaksauce> er yeah, since you add the loadpath to ruby
<RickHull> presuming you called `ruby -Ilib bin/chargen`
<weaksauce> so then, require "careers/#{career}" if you want to do it dynamically like that
<RickHull> dminuoso: my point is that yes, ruby is mad flexible and you can do crazy postmodern stuff with it, like in Perl
<RickHull> but there are also well established conventions and best practices that is similar to python methodology
kapil___ has joined #ruby
<RickHull> where the term "class method" is meaningful
<al2o3-cr> RickHull: class methods are merely instance methods on the singleton class
<RickHull> yes, and we can make the singleton class behave like a class instance with ivars
<RickHull> but rarely is that a good idea
<weaksauce> why did ruby call the anonymous classes that get created when you add methods to an instantiated object singleton classes instead of something with less baggage?
<dminuoso> RickHull: The only difference between a singleton clas and a non-singleton class, is that the type of that singleton class is inhabited by only one object. Non-singleton classes are (usually) inhabited by an infinite number of possible objects.
<dminuoso> weaksauce: ^- this is why.
<dminuoso> weaksauce: It has to do with basic type theory.
<dminuoso> weaksauce: When you consider a type as a set of possible values, singleton classes represent sets of just one object. Those sets are called "singleton sets"
reu_ has quit [Quit: こんなにも、世界はレプリスで満ちあふれていたのか? もし、今自分の手を傷つけてみたら、同じように泡を立てて消えていくのか?]
<RickHull> what are the types in ruby? can we enumerate them?
<dminuoso> RickHull: classes and you can.
<weaksauce> i get that that is the case but in general the singleton pattern is more prevalent it would seem and it muddies the people just getting into ruby from say java.
<leitz> Ruby has all types...
<leitz> FIxed the require. Do the dishes, fix teamgen, and then it'll be nappy time.
cahoots_ has quit [Ping timeout: 260 seconds]
<RickHull> is Array a ruby type?
<dminuoso> ObjectSpace.each_object(Class)
charliesome has joined #ruby
larcara has joined #ruby
<dminuoso> weaksauce: the singleton pattern name has the same origin :p
<weaksauce> :D yeah
jameser has joined #ruby
<RickHull> so Array is properly a type, a class, and an object - wonderful
<dminuoso> RickHull: well for the purpose of this discussion class and type are synonymous.
cahoots has joined #ruby
<RickHull> oh ok
<RickHull> >> Array
<ruby[bot]> RickHull: # => Array (https://eval.in/905734)
<RickHull> did I just instantiate an object?
<dminuoso> It already was.
garyserj has joined #ruby
<dminuoso> Array itself is of type Class.
<garyserj> does anybody here use haml?
<dminuoso> Ruby created it for you when it started.
<dminuoso> (Or rather when the VM is initialized)]
larcara has quit [Ping timeout: 260 seconds]
<garyserj> and does anybody here use sinatra?
<weaksauce> !ask
<RickHull> ?ask
<ruby[bot]> Don't ask to ask. Just ask your question, and if anybody can help, they will likely try to do so.
<weaksauce> perhaps that bot isn't around anymore
<weaksauce> ah
<dminuoso> RickHull: For what its worth, the clean separation of types and values in Haskell is much preferrable to this "everything is an object, including classes"
<dminuoso> Only thing Im missing is dependent types.
Lyubo1 has quit [Ping timeout: 255 seconds]
<RickHull> yes, I suppose I learned a much simpler programming model, with more limitations, that imposes dataflow structure
reu has joined #ruby
<RickHull> it's like structured programming without GOTO
<dminuoso> Ruby has goto.
<dminuoso> Like, actual goto.
<RickHull> it's an analogy
<weaksauce> i learned on basic years ago... that was basically goto programming
<RickHull> you can do all kinds of wacky stuff with GOTO
<dminuoso> No I mean like really.
<RickHull> (I know)
<RickHull> it's good that it's there, but it doesn't mean you should roll with the pigs in the mud at every opportunity
drewmcmillan has joined #ruby
<RickHull> it's much better to limit yourself and impose structure
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso> You can declare __label__(:foo) and __goto__(:foo) just fine!
<garyserj> How do you tell Sinatra to look at a haml file outside of the views directory?
drewmcmillan has quit [Client Quit]
Lyubo1 has joined #ruby
<RickHull> dminuoso: I program as though global variables and GOTO are not available. if I need to reach for them, so be it. likewise, I program as if "class methods" do not access ivars and behave much like functions
<RickHull> not everyone has to be like me :)
<RickHull> but wearing that straitjacket yields simple and easy to understand code, in my experience
<RickHull> and it is in accordance with the larger OOP world beyond ruby's specific impl
<RickHull> AFAIK
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RickHull> doing class << self just to avoid typing `self` on a few method signatures -- this adds indentation, LOC, inscrutability, and screws up the method signature
<RickHull> it matters whether the methods are defined on the singleton class
<RickHull> why hide that signature?
<RickHull> anyways...
<RickHull> when we look at rdoc, we see "class methods" and "instance methods" this is a sensible and common way of looking at ruby functionality
<weaksauce> as the saying goes, there are only two hard problems in computer science: cache invalidation, naming things and off by one errors
<RickHull> that's 11
oetjenj has joined #ruby
stevie has joined #ruby
<stevie> does ruby play nice with uwsgi?
<RickHull> stevie: are you familiar with rack?
mim1k has joined #ruby
<stevie> no
<leitz> Well, dang, it almost all worked.
charliesome has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
<RickHull> stevie: rack is ruby's standard web middleware, modeled off WSGI as i understand https://rack.github.io/
<RickHull> I'm not sure about uwsgi
<dminuoso> RickHull | dminuoso: I program as though global variables and GOTO are not available.
<dminuoso> You use if right?
<dminuoso> That's a conditional goto.
<RickHull> yes, as in structured programming
<RickHull> the Dijkstra "goto considered harmful" sense
<RickHull> the pedantic stuff about "peel back the covers and there's a jmp" isn't really helpful
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mim1k has quit [Ping timeout: 240 seconds]
<dminuoso> The irrational fear of goto is just a subconscious fear of imperative programming.
<dminuoso> People just know that "telling" the program to suddenly do weird things is bad.
<RickHull> nope, structured programming is objectively better
<RickHull> dijkstra wasn't being irrational
Algebr has quit [Remote host closed the connection]
Algebr has joined #ruby
<RickHull> and for sure, ceteris paribus, declarative programming is better than imperative
<RickHull> it's just that ceteris usually isn't paribus
<RickHull> but we'll get there one day ;)
<dminuoso> RickHull: Considering how "structured programming" introduces exceptions later, which are even worse than gotos in a particular way.
dinfuehr has quit [Ping timeout: 255 seconds]
<dminuoso> Namely that they are commonly implemented using non-local gotos.
<RickHull> i do like early returns, breaks, and exceptions
Psybur has joined #ruby
ramfjord has quit [Ping timeout: 248 seconds]
<garyserj> for a small project, is sinatra advantageous over rails?
<RickHull> there's a difference between an abstraction that uses goto in a structured way and littering your code with gotos
<dminuoso> RickHull: I still do believe, that all these things "dont abuse exceptions", "dont use goto the wrong way", "dont use global variables", are just symptoms of imperative programming. That isn't to say the paradigm is inherently bad, decades of successful projects show that this is not the case.
<RickHull> garyserj: I like starting with sinatra -- it's very quick and easy to get going
<RickHull> dminuoso: i'd make an analogy between declaring a rectangle vs driving a paintbrush
dinfuehr has joined #ruby
<leitz> For those awake who care, tonights changes to CT_Character_Generator have been merged into the master branch. I've been up for a while and it's nappy time. More fun in the morning.
<RickHull> driving a paintbrush can go wrong in many more varied ways
<RickHull> leitz: I might poke around -- til next time :)
<dminuoso> RickHull: Well at any rate, it is a religion war.
<dminuoso> And I finally found mine.
<dminuoso> Just admit that you are wrong.
<dminuoso> ;o
<RickHull> I have declared a fatwa on "x is merely a y on a z"
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leitz> RickHull, there's a big issue coming up; UPP might much better be a hash, but it's currently a string that gets split and reformed. It will affect a lot of code. Should make some cleaner though.
<leitz> Be sure you go back to the master branch.
<RickHull> what does upp mean?
webguynow has quit [Ping timeout: 255 seconds]
<leitz> Universal Personality Profile. The characters stats: strength, endurance, education, etc.
webguynow has joined #ruby
<RickHull> S P E C I A L
<leitz> Normally 6 Hex characters but there are two outliers that need to be handled.
<leitz> Modifying a key'd hash seems a lot easier.
<leitz> Feel free to open an issue if you like, I do. :)
Psybur has quit [Ping timeout: 248 seconds]
leitz has quit [Quit: Nappy time]
cahoots has quit [Ping timeout: 260 seconds]
<garyserj> Do you think Haml is helpful? I am using sinatra and haml, though i'm not sure how to point to aa haml file in the root, outside of the views directory.
<dminuoso> garyserj: No.
<dminuoso> At this point Im so close to going back to HTML again. The price tag of rendering engines is just too high. Any "boilerplate" issues are editor issues, not language issues.
cahoots has joined #ruby
cdg has joined #ruby
cahoots has quit [Client Quit]
ap4y has quit [Quit: WeeChat 1.9.1]
<RickHull> i think the problem with bypassing a rendering engine is you have to maintain a stack yourself
cdg has quit [Ping timeout: 258 seconds]
<RickHull> someone has to maintain the tag stack
Guest70176 has joined #ruby
<RickHull> and do you want to be doing stack manipulation in your views? or just call methods that do the stack manipulation behind the scenes?
ap4y has joined #ruby
<RickHull> but I haven't messed with this stuff in a while, maybe I'm misunderstanding
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
tvw has quit []
Guest70176 has quit [Ping timeout: 248 seconds]
Guest90_ has joined #ruby
Guest90_ has quit [Client Quit]
<RickHull> and then what should be responsible for e.g. double quotes for attributes and doing all the angle brackets, and tag styles for elements without inner text
pilne has joined #ruby
mtkd has quit [Ping timeout: 268 seconds]
<garyserj> I am totally new to the concept of something like haml
<garyserj> so i've no idea. i'm just going to be playing with it a bit.
<RickHull> I would stick with it for now
mtkd has joined #ruby
<RickHull> it's pretty standard and it is useful
<garyserj> at the moment I know it more as a quick way of writing html.. but is it not really, is it really for a template of html with variables and you inject data into the variables?
<RickHull> if you decide you hate it later, at least it will be based on experience that can apply to your next decision
QualityAddict has joined #ruby
<RickHull> my understanding is it's a way to call e.g. #form with some args that will define an html form for you
<RickHull> i think it touches on both templating and rendering
houhoulis has quit [Remote host closed the connection]
eightlimbed has joined #ruby
ensyde has quit [Quit: Leaving]
helpa has quit [Remote host closed the connection]
k3rn31_ has joined #ruby
helpa has joined #ruby
JBbanks_ has joined #ruby
Eletious_ has joined #ruby
MrSparkle has quit [Ping timeout: 240 seconds]
k3rn31 has quit [Ping timeout: 260 seconds]
Eletious has quit [Ping timeout: 260 seconds]
harfangk has joined #ruby
JBbanks has quit [Ping timeout: 240 seconds]
mson has quit [Quit: Connection closed for inactivity]
tuelz has quit [Quit: EliteBNC 1.6.3-git-6b28f4f - http://elitebnc.org]
MrSparkle has joined #ruby
oetjenj has quit [Read error: Permission denied]
FastJack has quit [Ping timeout: 258 seconds]
bdnelson has joined #ruby
oetjenj has joined #ruby
d^sh_ has quit [Ping timeout: 255 seconds]
uZiel has joined #ruby
d^sh has joined #ruby
FastJack has joined #ruby
bdnelson has quit [Client Quit]
tuelz has joined #ruby
bdnelson has joined #ruby
silvermine has joined #ruby
bdnelson has quit [Client Quit]
bdnelson has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
Technodrome has joined #ruby
brian_penguin has joined #ruby
marr has quit [Ping timeout: 268 seconds]
uZiel has joined #ruby
Psybur has joined #ruby
cschneid_ has joined #ruby
Cohedrin has quit [Read error: Connection reset by peer]
d^sh has quit [Ping timeout: 240 seconds]
Psybur has quit [Ping timeout: 248 seconds]
d^sh has joined #ruby
jackjackdripper has joined #ruby
bdnelson has quit [Quit: WeeChat 1.9.1]
Rouge has quit [Ping timeout: 268 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
Rouge has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gizmore|2 has joined #ruby
cryocaustik has joined #ruby
Bin4ry has joined #ruby
Guest70176 has joined #ruby
gizmore has quit [Ping timeout: 260 seconds]
<weaksauce> garyserj i like rails more because it's easier to get going for me
<weaksauce> it quite a bit more productive to me but sinatra is not bad
Guest70176 has quit [Ping timeout: 240 seconds]
dviola has quit [Quit: WeeChat 1.9.1]
<weaksauce> i like haml a lot for forcing consistency and making overly complex stuff in views harder
<weaksauce> but everyone has an opinion
<ule> Lets say I have something like: ["en", #<User id: 1, name: "foo">, "en", #<User id: 2, name: "bar">]]
<ule> How can I make this become this:
nofxx_ has joined #ruby
<weaksauce> yourarray.each_slice(2).map do |x,y| y end
<ule> { en: { #<User id: 1, name: "foo">, #<User id: 2, name: "bar"> } }
<weaksauce> jk
<Radar> ule: that syntax is valid. Do you want perhaps: { en: [user1, user2] } ?
<Radar> is invalid*
<ule> Radar: yeah, but I need to combine the two users under "en"
<ule> I'm actually going to have probably "en" and "fr". Im doing this to split in groups
<Radar> ule: use each_slice as weaksauce suggests, and then group_by.
<ule> ok
<ule> let me try
nofxx has quit [Ping timeout: 248 seconds]
sspreitz has quit [Ping timeout: 268 seconds]
<stevie> does ruby have an equivalent to virtual environments?
kitsunenokenja has quit [Ping timeout: 255 seconds]
sspreitz has joined #ruby
<weaksauce> stevie bundler is the closest that i know of
guardianx has joined #ruby
<weaksauce> different approach but similar outcomes
<weaksauce> it is actually better in my mind having played with both
Bin4ry has quit [Ping timeout: 268 seconds]
uZiel has quit [Ping timeout: 248 seconds]
Algebr has quit [Remote host closed the connection]
cdg has joined #ruby
Bin4ry has joined #ruby
brian_penguin has quit [Remote host closed the connection]
mson has joined #ruby
eightlimbed has quit [Ping timeout: 268 seconds]
Rouge has quit [Ping timeout: 260 seconds]
Psybur has joined #ruby
<ule> so
<ule> let me understand..
<ule> each_slice(2).map do |x,y| y end
<ule> this makes a new array only with Users
<ule> but
<ule> "en" is actually gone
jackjackdripper has quit [Quit: Leaving.]
<baweaver> array.each_slice(2).each_with_object(Hash.new { |h,k| h[k] [] }) { |(lang, user), h| h[lang] << user }
<ule> o_O
* baweaver throws sparkles in air
<baweaver> magic
<ule> lol
<ule> you guys are masters
<baweaver> Give that a read to understand what that hash was - https://medium.com/@baweaver/abusing-hash-constructors-65d59c0a5b27
<baweaver> Just be careful around the black magic section, I get a tinge carried away there
mim1k has joined #ruby
<ule> oh man.. thats awesome
Psybur has quit [Ping timeout: 248 seconds]
* baweaver is enjoying having a horde of lemur reactions to use
<Radar> ule: You can simplify this problem like this: : ["en", "]]
Rudolph has quit []
<Radar> ule: You can simplify this problem like this: : ["en", "user1", "en", "user2"]]
<Radar> >> ["en", "user1", "en", "user2"].each_slice(2).to_a
<ruby[bot]> Radar: # => [["en", "user1"], ["en", "user2"]] (https://eval.in/905759)
<baweaver> Note they want a hash
<Radar> Yeah. Got that. I am breaking it down into smaller easier to parse chunks.
<ule> but I want { en: { "user1", "user2" } }
<Radar> Chaining in Ruby can be confusing sometimes.
<Radar> What each_slice gives you is the pairing up of the user and their locale.
s2013 has joined #ruby
<baweaver> gotcha
<Radar> From that, you then need to group the users by the locale
* baweaver sits down and listens to Master Radar
<ule> users.map { |u| [u.language_code, u] }.flatten.each_slice(2).each_with_object(Hash.new { |h,k| h[k] [] }) { |(lang, user), h| h[lang] << user }
<baweaver> wait wait wait
<Radar> >> ["en", "user1", "en", "user2"].each_slice(2).each_with_object({}) { |(locale, user), group| group[locale] ||= []; group[locale] << user }
<ruby[bot]> Radar: # => {"en"=>["user1", "user2"]} (https://eval.in/905762)
<baweaver> you had that before it was like that?
<baweaver> then just do this instead: users.group_by(&:language_code)
<Radar> ^ ^ ^
<ule> c'mon.. can't be that simple
<Radar> Could be.
c0ncealed has quit [Remote host closed the connection]
<baweaver> Try it
<ule> facepalm :/
mim1k has quit [Ping timeout: 260 seconds]
<ule> let me try
c0ncealed has joined #ruby
<ule> worked like a charm
<ule> yeeeeeeeaaaahh
<baweaver> Giving the original code earlier helps ;)
<baweaver> keeps you from having to do some odd hacks
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Radar> >> User = Struct.new(:language_code); users = [User.new("en"), User.new("en")]; users.group _by(&:language_code)
<ruby[bot]> Radar: # => undefined method `_by' for main:Object (NoMethodError) ...check link for more (https://eval.in/905764)
<Radar> >> User = Struct.new(:language_code); users = [User.new("en"), User.new("en")]; users.group_by(&:language_code)
<ruby[bot]> Radar: # => {"en"=>[#<struct User language_code="en">, #<struct User language_code="en">]} (https://eval.in/905765)
* baweaver snickers
<baweaver> pesky spaces
<Radar> Switched from flat apple keyboard to mechanical keyboard about 15 mins ago and still adjusting
<baweaver> Sounds like an interesting type of change
<ule> Radar: exactly
<ule> dammit.. it was so simple
<baweaver> ule Takes time to get used to it
drewmcmillan has joined #ruby
Bin4ry has quit [Ping timeout: 260 seconds]
knight33 has joined #ruby
Anaasaa has quit []
jameser_ has joined #ruby
jameser has quit [Ping timeout: 240 seconds]
<ule> thank you very much guys
kryptoz has quit [Remote host closed the connection]
root3 has joined #ruby
<Radar> np mate
<root3> heello
larcara has joined #ruby
kryptoz has joined #ruby
mjolnird has quit [Remote host closed the connection]
<root3> why need this irc channel?
<havenwood> root3: This is a Ruby channel. Please feel free to ask Ruby questions here or share Ruby code.
<ule> root3: this is where ruby friends can talk about ruby
Bin4ry has joined #ruby
ap4y has quit [Quit: WeeChat 1.9.1]
<root3> havenwood: Thank
larcara has quit [Ping timeout: 240 seconds]
root3 has quit [Quit: WeeChat 0.4.2]
vee__ has quit [Ping timeout: 240 seconds]
root3 has joined #ruby
root3 has quit [Client Quit]
DTZUZU has joined #ruby
Bin4ry has quit [Ping timeout: 240 seconds]
_lyte_ has joined #ruby
Xiti` has joined #ruby
Xiti has quit [Ping timeout: 268 seconds]
Xiti` has quit [Read error: Connection reset by peer]
kryptoz has quit [Ping timeout: 268 seconds]
vee__ has joined #ruby
zanoni has quit [Ping timeout: 250 seconds]
bmurt has joined #ruby
Xiti has joined #ruby
harfangk has quit [Ping timeout: 240 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
harfangk has joined #ruby
Psybur has joined #ruby
mfb2 has joined #ruby
vee__ has quit [Ping timeout: 255 seconds]
uZiel has joined #ruby
guardianx has quit []
mfb2 has quit [Ping timeout: 240 seconds]
Psybur has quit [Ping timeout: 240 seconds]
rainbowz has joined #ruby
mikecmpb_ has quit [Quit: inabit. zz.]
Bin4ry has joined #ruby
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Bin4ry has quit [Quit: WeeChat 1.9.1]
vee__ has joined #ruby
David_H_Smith has quit [Remote host closed the connection]
Cohedrin has joined #ruby
larcara has joined #ruby
ur5us has quit [Remote host closed the connection]
gix- has joined #ruby
gix has quit [Disconnected by services]
larcara has quit [Ping timeout: 255 seconds]
orbyt_ has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Technodrome has joined #ruby
Guest70176 has joined #ruby
BTRE has quit [Quit: Leaving]
apparition has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rainbowz has quit [Ping timeout: 268 seconds]
plexigras has quit [Ping timeout: 248 seconds]
Guest70176 has quit [Ping timeout: 260 seconds]
ShekharReddy has joined #ruby
ur5us has joined #ruby
govg has joined #ruby
Psybur has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
cryocaustik has quit [Remote host closed the connection]
mjolnird has joined #ruby
Psybur has quit [Ping timeout: 268 seconds]
mim1k has joined #ruby
MrBusiness has joined #ruby
iamarun has joined #ruby
mim1k has quit [Ping timeout: 268 seconds]
mim1k has joined #ruby
mim1k has quit [Ping timeout: 248 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
larcara has joined #ruby
QualityAddict has quit [Ping timeout: 248 seconds]
enterprisey has joined #ruby
cdg has quit [Remote host closed the connection]
larcara has quit [Ping timeout: 268 seconds]
harfangk has quit [Ping timeout: 260 seconds]
reber has joined #ruby
_lyte_ has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
mtkd has quit [Read error: Connection reset by peer]
kryptoz has joined #ruby
mtkd has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
minimalism has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
LocaMocha has joined #ruby
Psybur has joined #ruby
tacoboy has quit [Ping timeout: 268 seconds]
tacoboy has joined #ruby
harfangk has joined #ruby
Psybur has quit [Ping timeout: 268 seconds]
mikecmpbll has joined #ruby
apparition has quit [Quit: Bye]
qba73 has joined #ruby
conta has joined #ruby
conta has quit [Remote host closed the connection]
oleo has quit [Quit: Leaving]
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
kanobt61_ has quit [Remote host closed the connection]
DoubleMalt has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
ramfjord has joined #ruby
larcara has joined #ruby
larcara has quit [Ping timeout: 268 seconds]
larcara has joined #ruby
rabajaj has joined #ruby
larcara has quit [Remote host closed the connection]
BTRE has joined #ruby
cschneid_ has quit [Remote host closed the connection]
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
apparition has joined #ruby
Technodrome has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
konsolebox has quit [Ping timeout: 240 seconds]
troys_ is now known as troys
InfinityFye has joined #ruby
konsolebox has joined #ruby
oetjenj has joined #ruby
Technodrome has quit [Quit: Textual IRC Client: www.textualapp.com]
Dimik has quit [Remote host closed the connection]
Psybur has joined #ruby
mark_66 has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Psybur has quit [Ping timeout: 240 seconds]
mostlybadfly has quit [Quit: Connection closed for inactivity]
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
exhiled has joined #ruby
konsolebox has quit [Ping timeout: 248 seconds]
conta has joined #ruby
konsolebox has joined #ruby
conta has quit [Remote host closed the connection]
DoubleMalt has quit [Ping timeout: 240 seconds]
konsolebox has quit [Ping timeout: 260 seconds]
konsolebox has joined #ruby
roshanavand has joined #ruby
qba73 has quit [Ping timeout: 250 seconds]
lele has joined #ruby
uZiel has quit [Ping timeout: 248 seconds]
ramfjord has quit [Ping timeout: 268 seconds]
maum has joined #ruby
andikr has joined #ruby
BioSpider has joined #ruby
Scorpion has quit [Quit: Leaving]
apparition has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
cdg has joined #ruby
aufi has joined #ruby
cdg has quit [Ping timeout: 252 seconds]
larcara has joined #ruby
ur5us has quit [Remote host closed the connection]
uZiel has joined #ruby
ana_ has joined #ruby
larcara has quit [Ping timeout: 260 seconds]
biberu has joined #ruby
larcara has joined #ruby
ur5us has joined #ruby
ur5us has quit [Remote host closed the connection]
mark_66 has quit [Read error: Connection reset by peer]
mark_66 has joined #ruby
iamarun has quit [Remote host closed the connection]
sonne has left #ruby [#ruby]
deepredsky has joined #ruby
iamarun has joined #ruby
Psybur has joined #ruby
minimalism has quit [Ping timeout: 260 seconds]
mfb2 has joined #ruby
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ShekharReddy has quit [Quit: Connection closed for inactivity]
claudiuinberlin has joined #ruby
guille-moe has joined #ruby
troys is now known as troys_
Psybur has quit [Ping timeout: 268 seconds]
mfb2 has quit [Ping timeout: 258 seconds]
TomyWork has joined #ruby
Immune has quit [Ping timeout: 248 seconds]
apparition has joined #ruby
minimalism has joined #ruby
DoubleMalt has joined #ruby
ta_ has quit [Ping timeout: 248 seconds]
ta_ has joined #ruby
enko has quit [Quit: Textual IRC Client: www.textualapp.com]
mikecmpbll has joined #ruby
guille-moe has quit [Ping timeout: 248 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
<Bish> dminuoso: who would expect a pure funcitonal language to have a good way to express ycombinator :D
<Bish> haskell can have utf8 names?
PhoenixMage has joined #ruby
biberu has quit []
<PhoenixMage> Hi All, how can I compile a gem from a Makefile? I have an issue with -Werror in the Makefile and it finishes compiling if I remove it and accept the warnings but have no idea what to do next...
<Bish> usually gems do not have makefiles, am i mistaking?
mim1k has joined #ruby
mikecmpbll has joined #ruby
<Bish> PhoenixMage: do you have a github? you could put it up there, and give it as a source in the gemfile
<Bish> otherwise you could do the same thing with filesystem, pretty sure
hurricanehrndz has quit [Quit: Goodbye]
hurricanehrndz has joined #ruby
cschneid_ has joined #ruby
<PhoenixMage> Bish: I have the source code with the modified Makefile and its compiled but no idea have to package it to a gem
<Bish> PhoenixMage: well, you might never know, since the dude who wrote the gem makes all kind of stuff
_aeris_ has quit [Remote host closed the connection]
<Bish> PhoenixMage: that's why yo should make it a github/repository
<Bish> and give it as source in your gemfile
<Bish> that way, your changes are ONLY about -Werror
_aeris_ has joined #ruby
maum has quit [Read error: Connection reset by peer]
cschneid_ has quit [Ping timeout: 255 seconds]
Burgestrand has joined #ruby
gregf_ has quit [Ping timeout: 260 seconds]
<Bish> so you can just take out what makes this gem not build, and leave the rest as is
<PhoenixMage> :/ Nothing is ever easy
<Bish> welcome to cs-hell
<PhoenixMage> If I am going to do that I might as well try to find the bug and fix it
<Bish> what gem is it?
<PhoenixMage> gRPC compiling on arm
<Bish> oh poor you, native gem on arm
<PhoenixMage> I am trying to make a gitlab package
<PhoenixMage> For archlinux
<Bish> had do google gRPC
<Bish> looks cool
<Bish> what do people need it for
<Bish> can you talk to gitlab with it?
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
<PhoenixMage> I have no idea what gitlab uses it for, I am just following the compile from source instructions and gRPC is needed for a bundle
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RevanOne has joined #ruby
<RevanOne> hey
<PhoenixMage> Running into this bug https://github.com/grpc/grpc/issues/11765 but for zlib
deepredsky has quit [Ping timeout: 268 seconds]
Psybur has joined #ruby
iamarun has quit [Read error: Connection reset by peer]
guille-moe has joined #ruby
iamarun has joined #ruby
Psybur has quit [Ping timeout: 240 seconds]
<Bish> it crashes while compiling tests
<Bish> that's funny
mim1k has quit [Disconnected by services]
mim1k_ has joined #ruby
<Bish> gcc7?
Guest70176 has joined #ruby
Azure has quit [Read error: Connection reset by peer]
<PhoenixMage> Yeah
conta has joined #ruby
qba73 has joined #ruby
<Bish> well, i would say you're asking for it :D
<Bish> with gcc7
silvermine has quit [Ping timeout: 255 seconds]
<PhoenixMage> And --with-cppflags=-Wno-error doesnt work :(
harfangk has quit [Ping timeout: 240 seconds]
<Bish> if you want everything to be easy
<Bish> you should stick to stable versions
<Bish> dont you think
<adaedra> gcc7 seems to be a stable version though
<Bish> not if you ask gentoo package management, which is the one i trust
<adaedra> It's even a .2
<Bish> well, you're right, didn't check that up
<Bish> holy shit, in august already
<Bish> i remember people calling me crazy when installing 6.0
Azure has joined #ruby
<PhoenixMage> I am just using the default build package archlinux-arm
Beams has joined #ruby
tomphp has joined #ruby
<PhoenixMage> Looks like I will need to work out how to do the github thing
<PhoenixMage> The irony that it is gitlab I am trying to compile is not lost on me, I just wish it wouldnt redownload the source every time I do gem install
marr has joined #ruby
enterprisey has quit [Ping timeout: 258 seconds]
DoubleMalt has quit [Ping timeout: 248 seconds]
<Bish> docker is your friend
howdoi has joined #ruby
DoubleMalt has joined #ruby
<PhoenixMage> What does docker have to do with it?
drewmcmillan has joined #ruby
<Bish> if you have a run gem install <some_gem> line in a docker file
<Bish> it certainly won't repull it
Azure has quit [Read error: Connection reset by peer]
<PhoenixMage> ah
<Bish> i was ultrasceptic when using containers at first, but it's sooo good, i use it for everything
<PhoenixMage> I am just cloning the repo will make the change and use the local repo
<PhoenixMage> I am a docker fan myself
<PhoenixMage> I use it for game servers most of the time though
<PhoenixMage> My Ark server is a docker container
jaruga has joined #ruby
<Bish> it solves so many problems that you shouldn't have in first place.. like non-compiling gems
<PhoenixMage> Agreed
<PhoenixMage> I think there is even a published docker container for gitlab on arm
qba73 has quit []
<adaedra> Wait, if I'm reading correctly, you are just trying to install Gitlab?
<adaedra> How do you get from this to manually compiling a gem from a Makefile?
<jokke> hi
<jokke> i have something in my codebase which causes my tests to block indefinately
<PhoenixMage> adaedra: grpc is a requirement for gitlab
<PhoenixMage> There is no gitlab package for archlinux-arm
<jokke> it's before the actual test is run and after the test setup
<jokke> is there a easy way to find the actual code responsible for the blocking?
<adaedra> Ah, but it's not a gem right?
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mtkd has quit [Ping timeout: 260 seconds]
mson has quit [Quit: Connection closed for inactivity]
dhollin3 has joined #ruby
<PhoenixMage> Its trying to install the gem when I install a gitlab bundle from the source
jaruga has quit [Ping timeout: 240 seconds]
<PhoenixMage> Its only cos the damn Makefile has -Werror in it
mtkd has joined #ruby
<adaedra> Ah, I see, it'd be the gem bridge
Azure has joined #ruby
<adaedra> Everyone should use -Werror
<adaedra> grpc itself is built correctly?
dhollinger has quit [Ping timeout: 255 seconds]
<PhoenixMage> I dont disagree as long as you test with it first, the zlib code in grpc still hasnt been updated to fix the fallthrough warnings
<adaedra> ha, the AUR package for grpc does filter the -Werror out
jenrzzz has quit [Ping timeout: 260 seconds]
deepredsky has joined #ruby
<adaedra> so, in order: did grpc itself (so not the gem) built correctly, or is it the one throwing the error?
<PhoenixMage> Its the one throwing the error
ams__ has joined #ruby
<adaedra> Okay
<adaedra> So you can try building using the technique seen in the AUR I guess
<PhoenixMage> Yeah reading that no
<PhoenixMage> w
<PhoenixMage> I essentially did the same thing manually
<adaedra> Ok
<PhoenixMage> If the grpc libraries are installed system wide will it not actually recompile for the gem?
<adaedra> No
<PhoenixMage> I assumed that the gem would be like a bubble
<adaedra> However, the gem may still try to compile for itself a tiny bit of code to link to grpc
<PhoenixMage> ah
<PhoenixMage> Good to know
<adaedra> A bubble?
Azure has quit [Read error: Connection reset by peer]
<adaedra> Wait PhoenixMage, I may be wrong
<jokke> anyone? :/
<adaedra> This lib is built weirdly
<adaedra> You could try to attach a debugger, jokke
<jokke> yes i did that
<jokke> but as soon as it's blocking it's too late
<adaedra> With a debugger, you should be able to interrupt the process once it's blocked and inspect the stacktrace
blackmesa has joined #ruby
<jokke> you mean pry?
iceden has quit [Ping timeout: 240 seconds]
<Bish> "attach" a debugger
<Bish> does ruby have a function like this now?
<adaedra> I must admit I let RubyMine handle that for me last time I needed it
<jokke> hmm
<Bish> pry is cool for stuff liek that, yah
<adaedra> But no, I mean a real debugger, which is usually an external process overseeing your program
<Bish> last time i checked ruby was not able to do such a thing?
lexruee has quit [Ping timeout: 248 seconds]
<adaedra> It's running a process apparently
<Burgestrand> You can use gdb with ruby
iceden has joined #ruby
<Burgestrand> It'd recommend compling ruby with debug symbols enabled though, otherwise it's a mess trying to figure out what's what
Psybur has joined #ruby
<adaedra> Bish: I think there's a part that gets required in the executed script, which allows the external control
<adaedra> But that's long ago
leitz has joined #ruby
<adaedra> Now I write bug-free code, much less hassle :p
<Bish> gdb with ruby :D
<Burgestrand> jokke looks like it's waiting for a system call though, you should be able to see what command it executed by looking at the process tree
<Bish> that's a good one
<jokke> couldn't i just trap interrupt?
silvermine has joined #ruby
<adaedra> Not sure the backtrace you get in trap would reveal the problem
lexruee has joined #ruby
<adaedra> But yeah, look at a htop or a ps to see what is launched by your script
minimalism has quit [Ping timeout: 240 seconds]
Azure has joined #ruby
<Bish> maybe strace helps
<Bish> rescued me in many hopeless situations
<Bish> jokke: strace -fp <pidof ruby>
<Bish> you might see the reason for the block
<Bish> or even invoke the bad script with strace -f -o output <bad_script>
<jokke> it just launches the test apparently
<jokke> from rake
<jokke> this is the command line: /home/jokke/.anyenv/envs/rbenv/versions/2.4.2/bin/ruby -Ilib:test -I/home/jokke/code/meso/energybox/bridge/vendor/bundle/gems/rake-12.1.0/lib /home/jokke/code/meso/energybox/bridge/vendor/bundle/gems/rake-12.1.0/lib/rake/rake_test_loader.rb test/acceptance/protocols/databox/stream_data_message/request_forwarding_2_test.rb
<Bish> try to invoke it with strace
<jokke> ok
<Bish> you will se a lot of shit, but there is a slight chance you can read the exact error
Psybur has quit [Ping timeout: 255 seconds]
apparition has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<Burgestrand> I think the process of running _that_, waiting until it hangs and then killing it with an interrupt to check the backtrace will give you better signal/noise ratio than the bazooka
<Bish> bazooka > all
apparition has joined #ruby
charliesome has joined #ruby
<jokke> Bish: awesome!
<Bish> so it's not blocking, it's retrying?
<Bish> this is the exact reason why strace > debugging in some cases
<Bish> particulary the hard ones
<Bish> jokke: where is the error in that dump?
mim1k_ has quit [Ping timeout: 252 seconds]
<Bish> just so i learn something
jenrzzz has joined #ruby
SirOliver has joined #ruby
lxsameer has joined #ruby
minimalism has joined #ruby
jameser_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RoneDreamer has joined #ruby
Serpent7776 has joined #ruby
RoneDreamer has quit [Remote host closed the connection]
Guest70176 has quit [Ping timeout: 255 seconds]
bigkevmcd has joined #ruby
<jokke> well i guess it's just that the mongodb connection is blocking
<jokke> or retrying indefinetly
cdg has joined #ruby
ldnunes has joined #ruby
cdg has quit [Ping timeout: 246 seconds]
esObe has quit [Ping timeout: 252 seconds]
deepredsky has quit [Ping timeout: 240 seconds]
Sina has quit [Quit: Connection closed for inactivity]
ldepandis has joined #ruby
<Bish> that's cool
<jokke> yeah i don't know about that. :P now it's even harder to find the error
deepredsky has joined #ruby
[spoiler] has quit [Quit: Cheers!]
<Bish> im sorry, then
[spoiler] has joined #ruby
char_var[buffer] has quit [Ping timeout: 268 seconds]
[spoiler] has joined #ruby
[spoiler] has quit [Client Quit]
deepredsky has quit [Ping timeout: 240 seconds]
[spoiler] has quit [Client Quit]
RoneDreamer has joined #ruby
[spoiler] has joined #ruby
RoneDreamer has quit [Remote host closed the connection]
RoneDreamer has joined #ruby
deepredsky has joined #ruby
mim1k has joined #ruby
<leitz> Is there a Ruby equivalent to Pythons "my_hash.get('key', <default_value>}" ?
<ta_> `{}.fetch(:key, "value"}`
<ta_> `{}.fetch(:key, "value")` even
<leitz> hehe...thanks!
* leitz goes off to refactor
roshanavand has quit [Read error: Connection reset by peer]
deepredsky has quit [Ping timeout: 248 seconds]
mim1k has quit [Ping timeout: 240 seconds]
tvw has joined #ruby
Psybur has joined #ruby
esObe has joined #ruby
SirOliver has quit [Quit: ZZZzzz…]
roshanavand has joined #ruby
deepredsky has joined #ruby
Psybur has quit [Ping timeout: 240 seconds]
minimalism has quit [Ping timeout: 240 seconds]
SirOliver has joined #ruby
SirOliver has quit [Client Quit]
RoneDreamer has quit [Remote host closed the connection]
RoneDreamer has joined #ruby
iamarun has quit [Remote host closed the connection]
vtx has joined #ruby
SirOliver has joined #ruby
ldepandis has quit [Ping timeout: 268 seconds]
mim1k has joined #ruby
<vtx> hi guys, does anyone here use sinatra? i’m trying to connect to a mongodb, and although i can connect, i think my client is cerating new connections for every request. looking at this recipe: http://recipes.sinatrarb.com/p/databases/mongo what does `:set` do? is it part of sinatra, or ruby in general? i currently assign my db connection as follows: `@db = mongo[database].database`, rather than using :set - is this why new connections are created for every request? w
<vtx> using :set solve this my ensuring only one connection is made and reused?
SirOliver has quit [Client Quit]
Immune has joined #ruby
MrBismuth has joined #ruby
<tbuehlmann> vtx: .set will really just only set it once. if mongo[database].database creates a new connection on each call, that might be it
jenrzzz has quit [Ping timeout: 248 seconds]
biberu has joined #ruby
MrBusiness has quit [Ping timeout: 255 seconds]
<vtx> oh, as an aside to that, maybe my code needs to do `@db ||= mongo[database].database`?
<vtx> tbuehlmann: is set part of sinatra DSL or is it a ruby thing?
<tbuehlmann> that's from sinatra
SirOliver has joined #ruby
Defenestrate has joined #ruby
snickers has joined #ruby
<vtx> okay thank you, i really appreciate it!
SirOliver has quit [Client Quit]
silvermine has quit [Quit: WeeChat 2.0-dev]
silvermine has joined #ruby
kryptoz has quit []
jenrzzz has joined #ruby
SirOliver has joined #ruby
SirOliver has quit [Remote host closed the connection]
jaruga has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
cdg has joined #ruby
deepredsky has quit [Remote host closed the connection]
deepredsky has joined #ruby
<ule> Hey guys
<RevanOne> error in my ruby code, what am I missing ?
<ule> ops just edit
<ule> RevanOne: replace ).to_s to: end.to_s
<ule> so guys.. I need to merge two hashes like this:
<ule> not sure if you know some magic ruby trick
cdg has quit [Ping timeout: 258 seconds]
larcara has quit [Remote host closed the connection]
<ule> its not actually a merge, its a combine
larcara has joined #ruby
<tobiasvl> RevanOne: I don't think you can use <%= on line 2 there? it seems to try to make the result of that line into a string, but it ends with an open block
<tobiasvl> but I haven't used erb in years
<ule> tobiasvl: already told him how to fix it
<tobiasvl> ule: no, actually you didn't :) if you look at line 2 in his gist, there's no ) in the actual ruby code. erb is inserting it
DoubleMalt has quit [Ping timeout: 268 seconds]
<tobiasvl> I assume erb is replacing <%= foo -%> with (foo).to_s
<ule> oh yeah
<ule> my bad
<RevanOne> hmm, so what is the actually solution then ? I cannot use 2 lines in my DO ?
mostlybadfly has joined #ruby
<tobiasvl> RevanOne: I don't remember how erb works, but can't you just change <%= to <% in line 2?
<tobiasvl> you just want that line to be evaluated, not printed
<RevanOne> i can
raynold has quit [Quit: Connection closed for inactivity]
larcara has quit [Ping timeout: 260 seconds]
guille-moe has quit [Ping timeout: 250 seconds]
<RevanOne> so only this line: <%= factvalueslb['results'].map{|h|h[1]['fqdn']}.each do |val| -%> to <% factvalueslb['results'].map{|h|h[1]['fqdn']}.each do |val| -%>
<RevanOne> ?
<dminuoso> You sir, need to learn about variables.
<dminuoso> There's nothing scary about stuff = factvalueslb['results'].map{ |h| h[1]['fqdn'] }; /* and then in some other place */ <% stuff.each do |val | %>
<ule> :/
<ule> im stuck on this for at least 2h
<dminuoso> ule: Are you sure you dont have the hash the wrong way?
<ule> what do you mean?
<dminuoso> ule: Let me show you
<dminuoso> ule: What if two users happen to share this? ['en', 'android', 'sub_message']
<ule> fixed
<ule> pls refresh that
ShekharReddy has joined #ruby
<dminuoso> ule: How are you constructing one/two?
<ule> Im using group_by
Psybur has joined #ruby
<dminuoso> ule: Can you show the input data format?
<ule> all_messages.map(&:user).group_by { |u| [u.language, u.platform] }
<dminuoso> ule: I meant the data, not the code
<ule> data is like that.. the only difference is that instead of 'user_1' is actually a Rails User object
guille-moe has joined #ruby
Defenestrate has quit [Quit: This computer has gone to sleep]
apparition has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<dminuoso> ule: can you show me the attribute shape?
<dminuoso> The reason Im trying to go back a bit further, is because I believe the way you are approaching this is twisted.
<RevanOne> Thank you guys, without "=" it worked
Defenestrate has joined #ruby
Psybur has quit [Ping timeout: 240 seconds]
apparition has joined #ruby
shinnya has quit [Ping timeout: 250 seconds]
<dminuoso> ule: Would I be correct in assuming its something along the lines of messages = [ { type: 'message', user: { language: 'fr', platform: 'ios', id: 1 } }, { type: 'sub_message': user: { language: 'en, platform: 'android', id: 2 }} ]
<ule> yeah, the only difference is that my type is: nil or ID
<ule> if I have a id, that means I have a parent, so its a sub_message
<ule> if the type is nil, that means its a parent message or first message in the thread
Guest70176 has joined #ruby
rabajaj has quit [Ping timeout: 240 seconds]
VladGh has quit [Remote host closed the connection]
cadillac_ has joined #ruby
VladGh has joined #ruby
Exagone313 has quit [Quit: see ya!]
truenito has joined #ruby
Exagone313 has joined #ruby
<ule> tried using a group_by with 3 elements inside an array
<ule> let me grab some coffee then I'll test with some real data
<ule> thanks though
sepp2k has joined #ruby
guille-moe has quit [Ping timeout: 240 seconds]
larcara has joined #ruby
<leitz> Logic failure somewhere. On a travis-ci run this failed on character['cash'] <= max_cash https://github.com/LeamHall/CT_Character_Generator/blob/master/test/tc_navy.rb#L31-L37
zanoni has joined #ruby
dcluna_ has quit [Quit: ZNC 1.6.3+deb1 - http://znc.in]
<leitz> It is testing this, which seems odd that cash could be > max_cash. What am I missing? https://github.com/LeamHall/CT_Character_Generator/blob/master/lib/tools/career.rb#L11-L20
<leitz> The next task is to refactor that muster_out method.
<leitz> Re-running the tests gives a pass, so there's some chance the math goes wrong.
SirOliver has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
deepredsky has quit [Ping timeout: 255 seconds]
RoneDreamer has quit []
deepredsky has joined #ruby
vtx has quit [Quit: vtx]
cdg has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
cschneid_ has joined #ruby
cdg has quit [Ping timeout: 252 seconds]
vereteran has quit [Quit: ZNC - http://znc.in]
naquad has joined #ruby
cschneid_ has quit [Ping timeout: 252 seconds]
tlaxkit has joined #ruby
pavelz has joined #ruby
<pavelz> hi, just wondering if there is a RESTy file storage service in ruby a simple one ?
<pavelz> preferably with filesystem and least amount cruft needed to get going. need to customize and emu some corporate service for devs.
Ambassador has joined #ruby
electrostat has quit [Quit: uwotm8]
drowze has joined #ruby
Psybur has joined #ruby
electrostat has joined #ruby
<leitz> Ah...may have it.
BioSpider has quit [Quit: Going offline, see ya! (www.adiirc.com)]
Psybur has quit [Ping timeout: 248 seconds]
kitsunenokenja has joined #ruby
cdg has joined #ruby
vtx has joined #ruby
SirOlive_ has joined #ruby
DK2 has quit [Ping timeout: 246 seconds]
<pavelz> prolly sinatra it till it works
<c-c> pavelz: maybe you can make fog use filesystem
SirOliver has quit [Ping timeout: 240 seconds]
<pavelz> nah looks too complicated )
cdg has quit [Remote host closed the connection]
cdg has joined #ruby
Defenestrate has quit [Quit: Leaving]
jottr has joined #ruby
<Bish> pavelz: how do you combine rest with files?
<Bish> i mean... rest usually means you're modifying the entries
<Bish> with update/patch whatever
<Bish> with files.. i would just imagning create, replace, delete
<Bish> pavelz: i had sucess using a combination of roda/shrine/sequel
<Bish> where i append files to database entries, really easily
<pavelz> post to a service a file get json back
<Bish> simple as model.file = post[:uploaded_file]
<Bish> and whats the content of said json?
<pavelz> application specific uuid and filename and such things
<Bish> yeah not really restful what u describe
<Bish> it would be.. if what you sends is exactly what u get back
<Bish> but what you describe is upload a file, and get a minimal json back
<Bish> but as i said, sequel/shrine make it really easy and you generalize it with roda
<c-c> its not rest or its not restful :D
<Bish> code snippet out of my current project:
<Bish> r.post { model.file = r.POST['file'] }
quobo has joined #ruby
<Bish> and this gets uploaded to s3 and simulates "syscalls" like read, seek, etc
guille-moe has joined #ruby
<Bish> CRUD would describe it better, wouldn't it?
tuelz has quit [Ping timeout: 255 seconds]
tuelz has joined #ruby
mikecmpbll has quit [Read error: Connection reset by peer]
vee__ has quit [Ping timeout: 268 seconds]
mikecmpbll has joined #ruby
drowze has quit [Ping timeout: 255 seconds]
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rouge has joined #ruby
zautomata has quit [Quit: WeeChat 1.7]
govg has quit [Ping timeout: 248 seconds]
zautomata has joined #ruby
zautomata has quit [Client Quit]
zautomata has joined #ruby
<leitz> Bish, CRUD would describe a lot of my code.
<leitz> Oh, you mean "Create..." :D
<Bish> i am no native speaker, i don't get it in case crud means something awful
<leitz> Crud is "junky, trashy" "He has a lot of crud in his background." or "His code is full of crud."
<Bish> eheh
<leitz> I have lived in a few countries and understand how odd the English language can be.
<leitz> Not to mention the English themselves...
zautomata has quit [Client Quit]
* leitz hopes the blokes are all busy at work and ignoring IRC.
<Bish> i've been to scotland, nice people
zautomata has joined #ruby
vee__ has joined #ruby
<Bish> but didn't understand a word, i'm bad with accents
<leitz> No one understands Scots, they just drink more.
<Bish> very stereotypical being you are
<Bish> literally everyhwere i went to buy something
<leitz> Yup.
<Bish> multiple people stopped whatever they were doing
<Bish> to help me to decide to buy the best thing
<Bish> not kidding: i was buying cigarettes and they didn't have my brand
<Bish> 3 people got out of line, to explain each tabbaco flavor to me
<Bish> that happened everytime i couldn't decide what to order/buy
<leitz> Americans like me and people from the UK make friendly fun of each other.
<leitz> I can believe that; I lived in England for a while. People there were the same.
webguynow has quit [Ping timeout: 260 seconds]
<leitz> Italy too.
<leitz> Err...and Germany, though I wasn't there as long. Just visiting.
webguynow has joined #ruby
<leitz> They were still shooting at us Gringos in Panama so I didn't get out much.
<Bish> lol, i've had a business meeting some weeks ago, and in the region where i live people aren't very friendly
<leitz> Sorry to hear. What region are you in?
Psybur has joined #ruby
<Bish> northrhine westfalia i think thats how it's written in english
<Bish> OWL more precicely
<Bish> highest compliment you can get here is no critism
<Bish> that's how people outside of the region describe us
<leitz> North-Rhine Westphalia
<leitz> If you want real abuse, ask for help with Ruby 1.8.7. It will make OWL seem very nice. :P
<Bish> that's before my ruby times
<Bish> well, don't use it?
<leitz> 1.8.7 is comes on Red Hat 6.
<leitz> Like my CentOS desktop.
<Bish> or am i being naive?
<adaedra> Good thing you can install more recent rubies :D
cdg has quit [Remote host closed the connection]
Psybur has quit [Ping timeout: 240 seconds]
<leitz> Bish, if I wanted to use Ruby at work I would have to use 1.8.7. Since that is a lot of work, I just use Ruby for myself at home.
apparition has quit [Quit: Bye]
<Bish> are there big incompabalities? i thought ruby rarely does that
uZiel has quit [Ping timeout: 248 seconds]
SirOlive_ has quit [Quit: ZZZzzz…]
<leitz> Interesitng rake test bug. Methods return their last "thing". If you don't use a variable set in the method but use it upon return, rake thinks the variable is unused.
<leitz> Bish, most of my old code works under 2.5. As I refactor I expect advice given here will break backwards compatibility. Ruby introduces stuff with new versions.
<Bish> 2.5 is out?
<Bish> man, im slow
snickers has quit [Ping timeout: 248 seconds]
<leitz> In preview.
<leitz> 2.5.0-preview1
<leitz> By the time I get good with Ruby 2.5 will be the 1.8.7. :)
roshanavand has quit [Read error: Connection reset by peer]
roshanavand has joined #ruby
oleo has joined #ruby
cdg has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
cdg has quit [Ping timeout: 258 seconds]
dviola has joined #ruby
marr has quit [Ping timeout: 248 seconds]
urk187 has joined #ruby
<darix> leitz: use the snapshot tarballs tbh.
<darix> that preview1 is really old
<darix> leitz: for opensuse I could even get you 2.5 packages.
<darix> leitz: but be warned 1-2 extensions are broken with 2.5 right now. (mostly profiling and debug tools though)
<leitz> darix, the git repo for 2.5 needs an extra step, I found that out the fun way.
<darix> leitz: yeah that's why i sticked to the snapshot tarballs :P
<leitz> Now I can't recall if I'm running from git repo or tar files from ruby-lang. Dang.
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
knight33 has joined #ruby
x77686d has joined #ruby
aufi has quit [Quit: Leaving]
<leitz> Time for a break. Back in a while, lots of refactoring left.
DLSteve has joined #ruby
deepredsky has quit [Ping timeout: 240 seconds]
deepredsky has joined #ruby
zautomata has quit [Ping timeout: 248 seconds]
InfinityFye has quit [Quit: Leaving]
zautomata has joined #ruby
nofxx_ has quit [Remote host closed the connection]
nofxx_ has joined #ruby
kitsunenokenja has quit [Ping timeout: 258 seconds]
tvw has quit [Remote host closed the connection]
deepredsky has quit [Ping timeout: 240 seconds]
zautomata1 has joined #ruby
plexigras has joined #ruby
zautomata has quit [Ping timeout: 240 seconds]
Psybur has joined #ruby
larcara has quit [Remote host closed the connection]
larcara has joined #ruby
marr has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Psybur has quit [Ping timeout: 268 seconds]
vee__ has quit [Ping timeout: 248 seconds]
larcara has quit [Ping timeout: 268 seconds]
SirOliver has joined #ruby
ananthakumaran has joined #ruby
milardovich has joined #ruby
ananthakumaran has left #ruby [#ruby]
RevanOne has quit [Ping timeout: 258 seconds]
Revan007 has joined #ruby
milardovich has quit [Ping timeout: 250 seconds]
tuelz has quit [Ping timeout: 255 seconds]
milardovich has joined #ruby
vee__ has joined #ruby
tuelz has joined #ruby
<leitz> Okay, my brain is melting. Starting to go in loops and need some help. Here's the error: https://gist.github.com/LeamHall/2e870bfaa62d7637e12b23f05986906c
kickr has quit [Quit: Leaving]
<leitz> The options["careers"] array is a list of files from a particular directory. Each one has a class that is a subclass of Career. The intent is that the character goes through a career.
Guest70176 has quit [Ping timeout: 248 seconds]
<leitz> the code intent is that the career can be called from the command line without having to manually opdate the possible list of careers by hand.
<leitz> In this case class Noble is in "noble.rb".
Revan007 has quit [Ping timeout: 240 seconds]
<leitz> I am trying to figure out how to call the class's method on the character instance.
zautomata1 has quit [Ping timeout: 260 seconds]
zautomata1 has joined #ruby
Guest70176 has joined #ruby
Technodrome has joined #ruby
Revan007 has joined #ruby
<dminuoso> character.method _
<dminuoso> ?
<leitz> dminuoso, I don't understand the question.
guille-moe has quit [Ping timeout: 248 seconds]
<dminuoso> leitz: I dont understand yours.
larcara has joined #ruby
guille-moe has joined #ruby
howdoi has joined #ruby
<leitz> Understood, this is one of the places I get confused. It is making a string from a file name into a class call.
Burgestrand has quit [Quit: Closing time!]
milardov_ has joined #ruby
rippa has joined #ruby
guille-moe has quit [Ping timeout: 248 seconds]
milardovich has quit [Ping timeout: 258 seconds]
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gizmore|2 is now known as gizmore
ana_ has quit [Ping timeout: 248 seconds]
drowze has joined #ruby
troys_ is now known as troys
drewmcmillan has joined #ruby
ledestin has joined #ruby
zautomata1 has quit [Ping timeout: 248 seconds]
x77686d has quit [Ping timeout: 240 seconds]
deepredsky has joined #ruby
thinkpad has quit [Ping timeout: 248 seconds]
quobo has quit [Quit: Connection closed for inactivity]
zautomata1 has joined #ruby
deepredsky has quit [Ping timeout: 258 seconds]
tvw has joined #ruby
conta has quit [Ping timeout: 248 seconds]
bmurt has joined #ruby
John__ has joined #ruby
tvw has quit []
tvw has joined #ruby
Guest70176 has quit [Ping timeout: 248 seconds]
<leitz> Do class method calls to sub-classes go to the parent class if the child does not have that method? Or do you have to specify "super".
<adaedra> If you do not override the method, the parent's one is called, yes.
<dminuoso> leitz: Keep in mind that, that modules of a class are also considered ancestors.
FahmeF has joined #ruby
<dminuoso> The order is: `Prepended modules, the class itself, included modules`, repeat with parent.
x77686d has joined #ruby
nopolitica has quit [Ping timeout: 240 seconds]
nofxx_ has quit [Remote host closed the connection]
<leitz> I'm just past the edge of my understanding. Not sure I can explain it well and was hoping the code was enough.
nofxx_ has joined #ruby
<leitz> Let me post the code and then what I think is happening.
milardovich has joined #ruby
<leitz> I'm calling bin/chargen.rb: ruby -Ilib bin/chargen.rb -c noble
<leitz> Which should set "options["careers"] to a single element array for "noble".
Cohedrin has joined #ruby
milardov_ has quit [Ping timeout: 255 seconds]
<havenwood> leitz: typically you'd add a shebang to the first line fo that file: #!/usr/bin/env ruby
Rouge has quit [Ping timeout: 268 seconds]
<leitz> But I'm getting a "update_character" "NoMethodError" on this line: https://github.com/LeamHall/CT_Character_Generator/blob/career_call_character/bin/chargen#L79
silvermine has quit [Ping timeout: 248 seconds]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<leitz> havenwood, I had one but was using more than one ruby. Also, calling it with the -Ilib lets it find the libraries.
<havenwood> leitz: then use a .rb extension
deadpoet_ has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leitz> So, what I am trying to do is have Class Noble, a subclass of Class Career, use Career#update_character. It seems to not want to.
<havenwood> leitz: #update_character looks like an instance method, so you'd need to call it on an instance of `#<Career:...>` not on `Career` itself.
<havenwood> Career.update_character #!> NoMethodError...
<leitz> Hmm...I'm trying to learn Class methods, I think. There's no real instance of Career, it just modifies character.
cschneid_ has joined #ruby
<havenwood> leitz: Then change Career from a Class to a Module and add `module_function` at the top of the module.
blackmesa has joined #ruby
<havenwood> leitz: Then you can call: Career.update_character(character, career, terms)
deadpoet_ has quit [Client Quit]
<havenwood> leitz: Or `include Career` in another class, and call: update_character(character, career, terms)
<leitz> Can you have parent and child modules?
<leitz> Where the child extends or modifies parent methods?
<havenwood> leitz: A module can mixin another module. They don't have offspring.
deepredsky has joined #ruby
x77686d has quit [Quit: x77686d]
SirOliver has quit [Quit: ZZZzzz…]
cschneid_ has quit [Ping timeout: 246 seconds]
Guest70176 has joined #ruby
andikr has quit [Read error: Connection reset by peer]
aef has quit [Ping timeout: 240 seconds]
deepredsky has quit [Ping timeout: 268 seconds]
Beams has quit [Quit: .]
Guest70176 has quit [Ping timeout: 240 seconds]
Serpent7776 has quit [Quit: Leaving]
mim1k has quit [Disconnected by services]
mim1k_ has joined #ruby
<leitz> Hmmm...Career is now a module, with module_function as the first line under "module Career". "Noble" is a class that has "include Career".
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
milardovich has quit [Remote host closed the connection]
<leitz> Still getting a NoMethodError for class Noble.
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Ping timeout: 268 seconds]
John__ has quit [Ping timeout: 240 seconds]
<leitz> Latest code pushed up.
mson has joined #ruby
cdg has joined #ruby
cdg has quit [Ping timeout: 255 seconds]
raynold has joined #ruby
rmhonji has joined #ruby
gregf_ has joined #ruby
mark_66 has quit [Remote host closed the connection]
ShekharReddy has quit [Quit: Connection closed for inactivity]
Ambassador has quit [Ping timeout: 252 seconds]
<havenwood> leitz: if you use module_function and include Career, the #update_character function will be private - so it can't be called externally on Noble, just from within Noble
<havenwood> leitz: you can get rid of `module_function` if you want to use it the way you've shown
rmhonji has quit [Client Quit]
<havenwood> &ri Module#module_function
roa is now known as Roa
<leitz> The goal is to be able to call <career_name>.update_character. Which was why I had it as a class, for inheritance.
char_var[buffer] has joined #ruby
danielpclark has joined #ruby
herbmillerjr has quit [Remote host closed the connection]
Rouge has joined #ruby
deadpoet has joined #ruby
<leitz> Hmm...Calling similar to that ruby-doc bit says I can't call it because it's a private method. Putting "public" before update_character fails with "undefiend method []"
mim1k_ has quit [Ping timeout: 248 seconds]
<apeiros> uh, where did you put the public?
<leitz> Different errors is progress. :)
nopolitica has joined #ruby
<apeiros> if you keep your gist up to date, it'd be easier
<leitz> apeiros, before the def update_character. And given the async nature of IRC I'm plugging along on different paths to see if I can figure it out.
Rouge has quit [Read error: Connection reset by peer]
bmurt has joined #ruby
<apeiros> leitz: if you want it public, you almost certainly don't want it to be a module_function
<apeiros> and in that case, you can just save yourself those two calls (module_function and public)
eightlimbed has joined #ruby
<leitz> apeiros, I want it to work. And be decent code. Doesn't fit either of those yet. I was trying havenwood's suggestion and then my own ideas when things still didn't work.
nopolitica has quit [Ping timeout: 240 seconds]
Rouge has joined #ruby
<apeiros> a public module_function usually isn't decent
milardovich has joined #ruby
claudiuinberlin has joined #ruby
<leitz> Working code with a public module_function is more decent than non-working code. :)
<apeiros> I'm not quite sure what part you don't understand
<leitz> In this case I have a path to follow, I think. When Noble and Career were both classes the instance variables for skills cuold be used in both. As a module within a class it seems not to work the same.
<apeiros> you can have more decent, AND working, AND less code, all for the price of ONE: removing both public and module_function
Ambassador has joined #ruby
<apeiros> (the "working" part of course depends on "private" being the only reason it didn't work)
milardovich has quit [Ping timeout: 268 seconds]
QualityAddict has joined #ruby
<leitz> private wasn't the only reason. :)
<apeiros> then putting "public" in front of it won't fix it anyway.
Guest70176 has joined #ruby
char_var[buffer] has quit [Quit: There is no System but GNU and Linux is one of its Kernels]
<apeiros> the exception says it's line 76
<leitz> Since Career became a module, and not a parent class, the @character stuff fails.
<apeiros> which implies skill_options is nil
<leitz> Yup.
<leitz> That's the NilClass in the gist.
vtx has quit [Quit: vtx]
<apeiros> skill_options = … assigns a local variable
<apeiros> you don't do anything with it except printing it
<apeiros> it'll be gone right after build_skill_options. I suspect that's not what you intend it to do.
mikecmpbll has quit [Ping timeout: 240 seconds]
<apeiros> oh, you want to use the *return value* of build_skill_options. well, that'll be nil, since puts is your last statement. and puts returns nil.
<leitz> Well, down in like 66 it's supposed to be set from calling build_skill_options.
char_var[buffer] has joined #ruby
<apeiros> yeah, ^
<leitz> Right, but it was failing before the puts.
<apeiros> pretty sure not with the same exception.
<leitz> Hate to dissappoint you, but yup.
<apeiros> or then again, maybe it did
<apeiros> since your puts says "NilClass" :D
larcara has quit [Remote host closed the connection]
<apeiros> so your stuff goes wrong before that already.
<leitz> The @skill_optiions seems the issue.
<leitz> They worked when Career was a class.
larcara has joined #ruby
<leitz> Now it is a module included by Noble. Don't seem to work as they are not being set.
<RickHull> leitz: the aesthetics look much better now, at least. follows ruby conventions :)
<apeiros> well, I don't see class Noble. so no idea. but yeah, the object you call update_character on must have @skill_options set.
<leitz> RickHull, you should look at muster_out. Much shorter. :)
<apeiros> iow, you probably want to initialize @skill_options in the Noble class
<RickHull> are you working on the career_call_character branch now?
<apeiros> also, you should not access foreign instance variables. use methods for that.
Guest70176 has quit [Ping timeout: 248 seconds]
<leitz> RickHull, yes.
<apeiros> leitz: line 12 sets an instance variable for the *class object*
<apeiros> those are not shared/passed on to instances of that class
<apeiros> you need an initialize method
eightlimbed has quit [Ping timeout: 240 seconds]
<RickHull> yes, it is odd to have class without `def initialize`
zapata has quit [Quit: WeeChat 1.9.1]
<RickHull> I suspect we can make the overall structure of this project much simpler
<leitz> apeiros, even if there's no instance of Career? In effect, it is supposed to modify a Character instance, not exist on its own.
<RickHull> perhaps 3-5 classes
<apeiros> leitz: if you create an instance of Noble, there's an instance of Career.
<apeiros> >> module Foo; end; class Bar; include Foo; end; Bar.new.instance_of?(Foo)
<ruby[bot]> apeiros: # => false (https://eval.in/906474)
<apeiros> grah
<RickHull> what is the problem domain? you have a character, and it can roll for attributes, get assigned a character class, which does additional character attribute stuff
<apeiros> >> module Foo; end; class Bar; include Foo; end; Bar.new.is_a?(Foo)
<ruby[bot]> apeiros: # => true (https://eval.in/906475)
<leitz> RickHull, the original idea is a Character class, a SuperClass Career for most career stuff, and then a bunch of Career Child classes for various types of career.
<RickHull> what are the main parts of a career?
<apeiros> (instance_of? checks whether it is an instance of the given class, is_a?/kind_of? test ancestry)
<RickHull> let's pick a good career example Knight?
<leitz> So chargen.rb creates a character with stats, descriptions, and empty skills and stuff. Careers add to skills and stuff and can modify stats.
<leitz> Career Noble.
<RickHull> ok, so Character Jim has class Bard and career Noble?
<RickHull> something like that?
<leitz> You guys should play Traveller some time. :)
<apeiros> if I had spare time…
troys is now known as troys_
<leitz> Character Jim has a career of Noble.
<apeiros> I assume traveller is some D&D style game?
<leitz> Character Jane has a career of Citizen.
kickr has joined #ruby
<RickHull> the design that pops into my head is to use composition. literally character has-a career
<apeiros> +1
deepredsky has joined #ruby
<leitz> apeiros, yes, but SciFi. One of the original Role-playing games and it lends itself very well to coding. Assuming I could code...
jaruga has quit [Quit: jaruga]
<RickHull> @career = Noble # perhaps -- a module reference
<apeiros> jim = Character.new(career: :citizen); jim.career # => Careers::Citizen
<RickHull> and each career has some methods -- a common interface
<apeiros> well, #<Careers::Citizen …> really
dionysus69 has joined #ruby
larcara has quit [Ping timeout: 240 seconds]
<RickHull> and when you call jim.foo -- the result is based on jim's attributes modified by the career
<leitz> RickHull, sounds good. I know very little about design and patterns. Keep typing, I'm taking notes.
moei has quit [Quit: Leaving...]
<RickHull> foo would do stuff based on jim's ivars, and also modify them based on calling module methods
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RickHull> do it all on-the-fly, worry about optimizing performance later
<leitz> Hang on a sec, I'll add to the gist to show the output when things work.
<RickHull> if you want to cache the results of career modifications
<apeiros> leitz: though it seems to me like careers are more like providing initial values for characters + how they'll level up?
<apeiros> btw., are you still restricted to ruby 1.8? (your project's README says so)
<RickHull> one headache with the current approach, ISTM at a glance, is that you are trying to commit all the behavior to concrete values -- whereas I would try to express the behavior as return values -- calculated on the fly
<leitz> Class Character provides the initial values, Career levels them up.
<RickHull> so Jim-the-Noble, what are some good examples of inherent attributes that the career then modifies?
<leitz> Skills, Stats, Cash, Stuff.
<RickHull> i would commit jim's baseline skill attribute to an ivar -- rolled at the beginning I expect -- and then have a skill() method that is modified by his career
deepredsky has quit [Ping timeout: 248 seconds]
<RickHull> and do it with expressions, not assignment
<leitz> apeiros, I'm now using 2.5.0. The readme is old.
<apeiros> great
<RickHull> def skill; @career.modify(@skill); end
<apeiros> I'm trying to do an outline, though it'll probably deviate a lot from what you intend to do since your tool seems to do a lot. but it might give you ideas :)
<apeiros> you store Character instances in the databse, did I get that right?
<leitz> RickHull, the data will go into various output formats, like SQL, Monggo, json.
FahmeF has quit [Remote host closed the connection]
<leitz> apeiros, when I get it to work, yes.
<RickHull> def sqldump; [self.skill, self.stats, self.cash, self.stuff].map { ... }; end
<RickHull> now, i may be barking up the wrong tree -- i'm certainly oversimplifying
TomyWork has quit [Ping timeout: 240 seconds]
<RickHull> what's a basic example of how a career modifies e.g. a cash attribute?
<leitz> An issue is that Class character has two uses: a framework for pulling in existing data and a "generate" method to write someone new up.
<RickHull> I would express this -- probably -- as making most of the class definition having to do with an existing character
<leitz> RickHull, each career is run in 1 or more 4 year terms. For (terms/2) +1 times a character gets a cash allocation and a "thing" benefit. That was the complexity of muster_out. Things could be skills, stuff.
eightlimbed has joined #ruby
<RickHull> and then a class method on character named generate -- Character.generate(*args)
<RickHull> so Character.new can be initialized with existing attributes -- to bring a fully formed Jim into the world as he was committed to the db last week
<RickHull> and Character.generate to roll a new Jane
<RickHull> Character.generate would do a bunch of dice rolls and come with the args to then call Character.new
<leitz> RickHull, one question on that. Character.new and Character.generate fit well with what I've done. The bit that I'm working on now is running a character through a career.
<RickHull> has to do with leveling up -- and?
larcara has joined #ruby
<leitz> I had a Character.run_career method but thought it might be better as something like "Noble(Character)"
jottr has quit [Ping timeout: 260 seconds]
tacoboy has quit [Remote host closed the connection]
<apeiros> leitz: only an outline (hence lots of "…") https://gist.github.com/apeiros/a0e3c6725cbb9a10db0a9ee8f87df894
* leitz goes to read.
<apeiros> though given the complexity, I'd probably create a full Character::Generator class and wrap that in Character.generate
<RickHull> sure -- though I would just leave that as an escape valve
<RickHull> my usual approach is to stuff everything into a giant bag, make it basically work
<RickHull> and then refactor to something nicer
<RickHull> rather than imagine a big hierarchy up front
ramfjord has joined #ruby
<apeiros> I usually do put a few minutes into considering an architecture. but a couple of stuff usually changes while writing.
<leitz> One design goal is to let other people add Careers easily. Really the career is mostly skill and benefits lists, with an occasional method override.
guille-moe has joined #ruby
<RickHull> leitz: i would keep that as a milestone
<RickHull> keep it in mind. but maybe limit the scope initially
milardovich has joined #ruby
<leitz> As is someone can drop a new career into lib/careers and call it with -c <new_career> and it just works. This is Ruby, you know. ;)
<RickHull> for example, maybe later you can transform careers into yaml definitions later
<leitz> Already works.
guacamole has joined #ruby
<leitz> In the master branch, anyway. :)
<RickHull> one problem is if you make the icing work before the cake is fleshed out, the icing limits your ability to make the cake work
<RickHull> so I like to make the cake rock-solid, and then ice it
<RickHull> (so to speak)
<RickHull> with a tight solid cake, with good tests, you can either ice it freely, or you can reconfigure it (thanks to the tests) to make it icing friendly
tvw has quit []
<leitz> Let's back up for a second. Is this a bad way to modifiy an instance? https://github.com/LeamHall/CT_Character_Generator/blob/master/bin/chargen#L74
milardovich has quit [Ping timeout: 240 seconds]
<gizmore> leitz: rename the method to "apply/change"Foo?
<gizmore> modify / adjust... :P
<leitz> The *theory* is that there's a better way, but that's just my assumption. The original operation is fairly modular and extensible. And testable. At this point I'm wondering if I'm trying to solve a non-problem.
<apeiros> leitz: generally in OO, you want to only mutate the receiver of a method
<gizmore> leitz: why should changing an instance being a bad habit?
<gizmore> thx apeiros
blackmesa has quit [Ping timeout: 240 seconds]
<leitz> gizmore, the way I'm changing it.
<leitz> So, if you run a character instance through a career, the character is modified. Skills, etc.
danielpclark has quit [Ping timeout: 240 seconds]
<apeiros> yeah, sounds fine
<leitz> apeiros, in that line is character the reciever?
<RickHull> leitz: forget the code for a sec -- what's a concrete example of how a career affects a character?
<gizmore> yeah--- i have the same. the skill type change the char
<apeiros> leitz: yes. the thing to the left of the dot.
<apeiros> receiver.method(argument) { block }
tomphp has joined #ruby
<RickHull> leitz: is there a time component? does the career or char know that 10 years has passed?
<apeiros> and if you just do `method(argument) { block }` (where arguments and block are optional of course), then `self` is the receiver.
<RickHull> or is it more "tick" based -- character.yearly_update
<RickHull> character.level_up
guacamole has quit [Quit: My face has gone to sleep. ZZZzzz…]
David_H_Smith has joined #ruby
<leitz> RickHull, in the updated comment the bold stuff is modified by a career. https://gist.github.com/LeamHall/2e870bfaa62d7637e12b23f05986906c
<apeiros> so it's officially a terrible idea to eat raclette cheese and not wash your hands before using keyboard & mouse again 😅
milardovich has joined #ruby
<leitz> The UPP (67B84B) usially is.
guacamole has joined #ruby
conta1 has joined #ruby
<apeiros> what's UPP? some kind of descriptive string for your char?
<leitz> apeiros, or eat pecan pie with the same hand on the trackball...
<RickHull> universal personality profile
<RickHull> the initial char roll
<apeiros> that roll defines some baselines of the stats?
<leitz> ^ Initial, as possibly modified by career.
LocaMocha has quit [Ping timeout: 240 seconds]
<leitz> That roll is the stats. In Hex format.
guacamole has quit [Client Quit]
<RickHull> leitz: there are 3 components to that string, right?
guille-moe has quit [Ping timeout: 240 seconds]
<RickHull> you are right that a string is not the best choice to store this data
kapil___ has joined #ruby
<RickHull> i would do an array of ints
<leitz> RIckHull, 6 components
<RickHull> or possibly a hash, like you mentioned last night
AlexRussia has quit [Ping timeout: 240 seconds]
<leitz> And I'm thinking hash since each Stat would serve as a unique key.
<RickHull> oh, i thought it was 0x67 0xb8 0x4b
<RickHull> yes, if there are names for each stat, use a hash
<RickHull> or possibly struct/openstruct -- but i would start with a hash
<RickHull> or possibly ivars. @stat_this = 0x67 @stat_that = 0x4b
<leitz> Average is 7, so Strenght 6, Dexterity 7, Endurance 11, Intelligence 8, Education 4, Social Status 11.
<leitz> Or Str Dex End Int Edu Soc for keys.
<RickHull> i would use ivars probably, and maybe have a stats_hsh() method if you pass them around as a group
<leitz> Since I'm guessing on how to spell intelligence.
<RickHull> >> { strength: 0x45, dexterity: 0x4b, }
<ruby[bot]> RickHull: # => {:strength=>69, :dexterity=>75} (https://eval.in/906519)
<apeiros> ok, so a char doesn't have a career, you apply one to it, and that modifies their stats + skills + advanced skills?
<leitz> RIckHull, ivar is instance varialbe? Or something else?
<apeiros> and skills are replaced, not added if I got that right
nopolitica has joined #ruby
<RickHull> yes, as in `attr_reader :strength`
milardovich has quit [Ping timeout: 248 seconds]
ldepandis has joined #ruby
<leitz> apeiros, a character has served in a career, like we do. But a career is not a thing.
<RickHull> or def initialize(str, dex, end); @strength = str ...
<leitz> Skills are added. If a person has a high Edu then they can learn Advanced Skills.
<apeiros> ok
<leitz> That's the skill_options array.
<leitz> And it is an array, not a set, as some skills are more likely than others, based on career.
<leitz> Army people shoot more. :)
<apeiros> but the added skill is random, or can be random
<leitz> Is random.
<RickHull> i would add a hash key for every added skill
<leitz> Educated people can get skills from either list.
<apeiros> uh, I'd not do that by repeating, I'd do that by using a hash with skill as key and relative probability as value
<leitz> RickHull, already done. :)
x77686d has joined #ruby
<leitz> apeiros, number of skills is based loosely on terms served.
<apeiros> e.g. {Skill1: 1, Skill2: 2, Skill3: 1}, where Skill2 is twice as likely to happen compared to Skill1 and Skill3
<leitz> apeiros, at the moment I just "yy p" the skill in vim if i need it more often. I'm not a math wiz.
tlaxkit has quit [Remote host closed the connection]
tlaxkit has joined #ruby
tlaxkit has quit [Max SendQ exceeded]
nopolitica has quit [Ping timeout: 268 seconds]
<leitz> So, at this point I think the branch is a learning exercise but not the way to go. The original works properly where the reciever of the method is modified.
<leitz> And I can bask in the glory of a heavily reduced "muster_out" method.
danielpclark has joined #ruby
lupine has quit [Remote host closed the connection]
ramortegui has quit [Quit: This computer has gone to sleep]
Rouge has quit [Remote host closed the connection]
lupine has joined #ruby
<leitz> apeiros, this is the other way I get random stuff in easily. Just pull from a "single phrase per line" text file. Though your "sample" comment is going to get used heavily. https://github.com/LeamHall/CT_Character_Generator/blob/master/lib/tools/character_tools.rb#L46-L57
blackmesa has joined #ruby
<apeiros> "Straight medium brown short" # hah
<apeiros> hm, I should cleanup my backup-inception. I have a weighted sample lying around somewhere
Rouge has joined #ruby
<apeiros> though I guess I can just rewrite it…
ams__ has quit [Quit: Connection closed for inactivity]
mikecmpbll has joined #ruby
vtx has joined #ruby
<leitz> If you don't mind looking at Python/Bottle, this is where I'm going with some of this. There will be a web page where people can view characters. I'm using the database to track characters in my stories, I keep forgetting things like hair color, etc. https://github.com/makhidkarun/py_npc_web_db/blob/master/bottle_dragon.py
<pecan> Don't eat me please leitz :o
<leitz> *burp*
Guest70176 has joined #ruby
mcr1 has quit [Ping timeout: 252 seconds]
Dimik has joined #ruby
muelleme has joined #ruby
<leitz> You guys really should try Traveller. Pretty easy and lots of things to code about.
larcara has quit [Remote host closed the connection]
exhiled has joined #ruby
<wmoxam> leitz: what's that?
<leitz> wmoxam, one of the earliest pen and paper role playing games.
larcara has joined #ruby
<leitz> And the source of most of my coding efforts.
<wmoxam> ah
Guest70176 has quit [Ping timeout: 240 seconds]
chmurifree has quit [Ping timeout: 252 seconds]
blackmesa has quit [Ping timeout: 246 seconds]
drewmcmillan has quit [Quit: Textual IRC Client: www.textualapp.com]
<leitz> Well, if i could document C code well there are 5,320 opportunities to excel. :)
urk187 has quit [Remote host closed the connection]
<RickHull> leitz: I forked your repo, stubbed out what seems to me like a more sensible base: https://github.com/rickhull/CT_Character_Generator/blob/rickfactor/lib/traveller_char/character.rb
larcara has quit [Ping timeout: 240 seconds]
chmurifree has joined #ruby
<leitz> RickHull, thanks! Let me go study that.
conta has joined #ruby
<RickHull> obviously fill in the legit generator procedures
<RickHull> as apeiros suggested, you definitely want a module for the generator stuff
<RickHull> maybe within Character -- e.g. Character::Generator (exactly as apeiros suggested)
<RickHull> this allows to call Character.generate(basic: { name: 'Jane', gender: 'F' })
<RickHull> er, let me update. should be Character.generate(name: 'Jane', gender: 'F')
<RickHull> and any of the other basic stats will be generated. or provide nothing and name and gender will be generated as well
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RickHull> what this means is that Character.new will require concrete values for everything
<RickHull> i.e. load from yesterday's dump
<RickHull> and only Character.generate will create a new character with generated values
<leitz> The initialize takes the exisitng data provided.
<RickHull> in your version, where is @upp initialized?
<leitz> Line 14 in generate.
<RickHull> oh duh, sorry
<leitz> Currenly as a string, will move to hash after the after big meal nap.
<RickHull> sorry, what I meant was: your version allows to initialize a character without an :upp
exhiled has joined #ruby
<RickHull> and when you call character.generate, it will be generated conditionally
David_H_Smith has quit [Remote host closed the connection]
<RickHull> so you are mixing the concepts of a fully realized character vs generating a new one
<RickHull> my version separates them completely
<RickHull> you can only call Character.new with fully realized values
<leitz> Yes. For example, in a story a person comes up just by name. Later, UPP and everything else is needed, so the known data gets put in and the rest generated.
blackmesa has joined #ruby
<RickHull> it's cleaner to just generate a fully realized character when a new one comes up
<RickHull> if all you need is a name, then just represent the fake char with their name string
<leitz> Actaully, you can call Character.new with nothing, and then generate en masse or add bit by bit.
dionysus69 has quit [Quit: dionysus69]
<RickHull> I think this mixing of concerns causes complications in the code built on top
milardovich has joined #ruby
<vtx> guys in my rspec tests, i have `allow(Mongo::Client).to receive(:new).with(any_args).and_return(mock_database_map)`, however, when i run my tests, MongoDB still attempts to connect to local host, failing repeatedly, and none of my specs are ran
<leitz> That's why I want to keep Careers separate. So a Character can be used by itself.
<RickHull> I would make a different class for NPCs
<vtx> the line in my application that connects to mongo is `mongo = Mongo::Client.new(["#{host}:#{port}"], :database => database)` - how can i stop this from connecting? or rather, how can i tell my tests that the connection was always successful?
<RickHull> perhaps both derive from the same base class
cschneid_ has joined #ruby
<RickHull> NPC concerns are quite distinct from P concerns
<RickHull> er, PC concerns :)
larcara has joined #ruby
<leitz> vtx, are you actually trying to connect?
<RickHull> the app wants to connect -- the test wants the app not to connect
<leitz> RickHull, I have a really bad habit of promoting minor charcters to full blown heroes.
<RickHull> leitz: sure, you can accomodate that -- just create a PC from NPC attributes
<vtx> leitz: i don’t want the database connection to happen during my tests
<leitz> Like, dozens. Easier to treat everyone the same.
<vtx> i want to mock out the responses
jaruga has joined #ruby
<RickHull> but trying to have do-all wonder-class that accomodates all concerns -- I'm skeptical
<leitz> vtx, ah. Gotcha. I'm not that good with Rspec.
<vtx> neither am i haha
<leitz> RickHull, that's why I'm going to use a MongoDB backend. I can add fields as needed as characters develop.
<RickHull> leitz: if NPC and PC both inherit from BasicChar -- then you can have stuff that doesn't care about NPC distinction operate on BasicChar
milardovich has quit [Ping timeout: 260 seconds]
<vtx> i guess it would be a nice to see what connection is actually taking place, i.e. to see if i’m missing something in my mock
<leitz> RickHull, Both PC and NPC grow backstories as I go along. No real differentiation.
<RickHull> and if all NPCs *should* be fully realized -- then don't try to generate stuff on the fly
<RickHull> you will have bugs
<leitz> vtx, I would, at least at first. I code poorly and that would be expensive but test me often.
<RickHull> for example, you pass around hashes and forget to include a field. you will want an error here
<RickHull> but instead it will get silently autogenerated
x77686d has quit [Quit: x77686d]
<leitz> RickHull, that's why Character.generate must be called separately.
<leitz> No autogeneration unless I tell it to.
larcara has quit [Ping timeout: 260 seconds]
<vtx> is there a way to have ruby print out all the calls that are happening? so i can see why my mock isnt working? or rather are there any tools that you can pass a line of ruby to, and they tell you how to mock that line?
Tim_F_Croso has joined #ruby
<RickHull> well @upp only gets assigned in #generate
<RickHull> it sure looks like you have to call #generate to get an @upp
<leitz> RickHull, unless the call to Character.new includes a data set with the upp.
<RickHull> where does @upp get assigned in that case?
<leitz> It will get pulled from the database as soon as I get that far. DId you look at the python/bottle stuff?
<leitz> Same idea.
<RickHull> hang on, i call Character.new(upp: stuff)
<RickHull> @upp will not exist at that point
<RickHull> it only comes into being with Character.new(upp: stuff).generate
<RickHull> you've written #generate to be the place where the hash becomes ivars
<leitz> Being called to the table. I'll test and answer that in a bit.
<RickHull> yep, i gotta run
<RickHull> cheers!
conta1 has quit [Remote host closed the connection]
milardovich has joined #ruby
larcara has joined #ruby
zautomata1 has quit [Ping timeout: 248 seconds]
milardovich has quit [Ping timeout: 268 seconds]
zautomata1 has joined #ruby
ensyde has joined #ruby
alan_w has joined #ruby
Guest59285 has joined #ruby
<havenwood> an easter egg if you have the computing power:
<havenwood> require 'prime'; [0.step.lazy.select { |n| (67 ** n - 66 ** n).prime? }.take(3).reduce(1, :*) * 3 * 3 * 3].pack('U')
nadir has joined #ruby
nopolitica has joined #ruby
Dimik has quit [Ping timeout: 260 seconds]
cschneid_ has quit [Remote host closed the connection]
danielpclark has quit [Ping timeout: 246 seconds]
nopolitica has quit [Ping timeout: 268 seconds]
mcr1 has joined #ruby
<leitz> Did someone say bundler doesn't work with 2.5.0Dev?
<RickHull> i was having a problem with it on travis
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RickHull> oh, that was with -preview1
<leitz> I'm getting UnsatisfiableDependencyError for 1.16.0.
<leitz> I just pulled from git, same issue.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
mcr1 has quit [Ping timeout: 248 seconds]
dhollin3 is now known as dhollinger
eightlimbed has quit [Ping timeout: 240 seconds]
knight33 has joined #ruby
Guest70176 has joined #ruby
tacoboy has joined #ruby
danielpclark has joined #ruby
<havenwood> oops, messed up my easter egg >.>, shoulda been:
<havenwood> require 'prime'; [Prime.take(2.step.lazy.select { |n| (67 ** n - 66 ** n).prime? }.take(3).reduce(1, :*)).last * 3 * 3 * 3].pack('U')
<dminuoso> havenwood: Its amazing how bad Ruby is at this.
dionysus69 has joined #ruby
<havenwood> dminuoso: not fast!
<dminuoso> Speed is just a QoI issue.
truenito has quit [Ping timeout: 268 seconds]
<dminuoso> havenwood: You should run this on truffle.
<havenwood> here's a "solution":
s2013 has joined #ruby
<leitz> RickHull, humorously, the earlier version of Character#initilize set the values to certain types. I cleaned it out not too long ago.
<havenwood> dminuoso: it's fast but seemingly not the same result, hrmmm
<havenwood> jt ruby -e "require 'prime' ;puts [Prime.take(2.step.lazy.select { |n| (67 ** n - 66 ** n).prime? }.take(3).reduce(1, :*)).last * 3 * 3 * 3].pack('U') * 3"
<havenwood> #>> 666
Guest70176 has quit [Ping timeout: 250 seconds]
armyriad has joined #ruby
<havenwood> well, i gotta turkey - curious to look into that later though!
<havenwood> o/
exhiled has joined #ruby
deepredsky has joined #ruby
x77686d has joined #ruby
milardovich has joined #ruby
ldnunes has quit [Quit: Leaving]
dionysus69 has quit [Ping timeout: 240 seconds]
deepredsky has quit [Ping timeout: 268 seconds]
milardovich has quit [Ping timeout: 268 seconds]
moei has joined #ruby
dviola has quit [Ping timeout: 255 seconds]
John___ has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
selim has quit [Ping timeout: 260 seconds]
selim has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
miskatonic has joined #ruby
rivalomega has joined #ruby
jamesaxl has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cadillac_ has joined #ruby
danielpclark has quit [Ping timeout: 248 seconds]
x77686d has quit [Quit: x77686d]
exhiled has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rouge has quit [Ping timeout: 246 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackmesa has quit [Ping timeout: 250 seconds]
<vtx> guys at what point does a configure block run?
milardovich has joined #ruby
knight33 has joined #ruby
lexruee has quit [Ping timeout: 240 seconds]
milardovich has quit [Ping timeout: 255 seconds]
vtx has quit [Quit: vtx]
ahrs has quit [Remote host closed the connection]
ahrs has joined #ruby
danielpclark has joined #ruby
nopolitica has joined #ruby
lexruee has joined #ruby
eightlimbed has joined #ruby
vtx has joined #ruby
<c-c> vtx: which configure block?
<vtx> c-c: so, the configure block in a sinatra application?
nopolitica has quit [Ping timeout: 248 seconds]
<vtx> i.e. if my class extends Sinatra::Application, and that class contains `configure do…end`, at what point does that block actually run?
ur5us has joined #ruby
knight33 has quit [Read error: Connection reset by peer]
mcr1 has joined #ruby
drowze has quit [Ping timeout: 248 seconds]
cdg has joined #ruby
Guest70176 has joined #ruby
blackmesa has joined #ruby
cdg has quit [Ping timeout: 250 seconds]
ShekharReddy has joined #ruby
Guest70176 has quit [Ping timeout: 260 seconds]
milardovich has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
milardovich has quit [Ping timeout: 268 seconds]
ramortegui has joined #ruby
<leitz> is there a way, in a class, to iterate through hash.each do |key,value| to set instance variables to the key?
ldepandis has quit [Quit: Textual IRC Client: www.textualapp.com]
reber has quit [Quit: Leaving]
Tim_F_Croso has quit [Quit: good bye cruel world]
vtx has quit [Quit: vtx]
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
sunrunner20 has quit [Quit: So Long and Thanks for All the fish]
<dminuoso> "set instance variables to _the_ key" ?
<dminuoso> What does that even?]
_sfiguser has joined #ruby
lexruee has quit [Ping timeout: 248 seconds]
Ambassador has quit [Quit: Leaving]
jottr has joined #ruby
lele has quit [Ping timeout: 264 seconds]
nopolitica has joined #ruby
lele has joined #ruby
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
danielpclark has quit [Ping timeout: 248 seconds]
nowhere_man has quit [Ping timeout: 240 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
nopolitica has quit [Ping timeout: 255 seconds]
troulouliou_div2 has joined #ruby
x77686d has joined #ruby
<c-c> Would the key be a string or a symbol?
Xeago has quit [Ping timeout: 248 seconds]
Guest70176 has joined #ruby
blackmesa1 has joined #ruby
muelleme has quit [Ping timeout: 246 seconds]
blackmesa has quit [Read error: Connection reset by peer]
Xeago has joined #ruby
ramortegui has quit [Quit: This computer has gone to sleep]
<apeiros> leitz: there's instance_variable_set, which is used like: instance_variable_set(:"@foo", value)
John___ has quit [Read error: Connection reset by peer]
Guest70176 has quit [Ping timeout: 248 seconds]
<apeiros> though often when you do that you should probably either use a Struct or a Hash directly.
sunrunner20 has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
danielpclark has joined #ruby
tomphp has joined #ruby
tomphp has quit [Client Quit]
tomphp has joined #ruby
tomphp has quit [Client Quit]
tomphp has joined #ruby
tomphp has quit [Client Quit]
deepredsky has joined #ruby
tomphp has joined #ruby
eightlimbed has quit [Ping timeout: 240 seconds]
ur5us_ has joined #ruby
eightlimbed has joined #ruby
Cohedrin has joined #ruby
lexruee has joined #ruby
deepredsky has quit [Ping timeout: 248 seconds]
ur5us has quit [Ping timeout: 268 seconds]
FahmeF has joined #ruby
ramortegui has joined #ruby
milardovich has joined #ruby
jenrzzz has joined #ruby
FahmeF has quit [Ping timeout: 268 seconds]
Cohedrin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jamesaxl has quit [Read error: Connection reset by peer]
milardovich has quit [Remote host closed the connection]
jamesaxl has joined #ruby
LocaMocha has joined #ruby
jaruga has quit [Quit: jaruga]
<RickHull> leitz: yep -- if it seems like my code is doing much of what yours is/was, but slightly differently, that's on purpose :)
<RickHull> i definitely think there is a win in separating character generation from having a realized character
<RickHull> you don't want missing attributes to be silently generated instead of causing an error
<RickHull> i love errors :)
<RickHull> (I hate hiding them)
ramortegui has quit [Quit: This computer has gone to sleep]
mim1k has joined #ruby
<RickHull> likewise, i would make sure there is a solid core before trying to layer on user-defined generation schemes or NPCs that can morph into full chars
x77686d has quit [Quit: x77686d]
<RickHull> let's reduce the scope and make something rock solid first
drowze has joined #ruby
<RickHull> that said, it's good to keep in mind how the core will be extended -- but don't put on the extension handcuffs sooner than necessary
<RickHull> one common problem with deep, complex, nested hash data structures is that there are often missing fields, or field values that are slightly "out of spec"
<RickHull> if there even is a spec or schema
<RickHull> in the security world, there is the concept of rings. ring 1's functionality is based on having a rock-solid ring 0
<RickHull> you could always make an uber-ring that combines the concerns of rings 1-4
sunrunner20_ has joined #ruby
<RickHull> and there could be some small wins there. but likely huge losses
mim1k has quit [Ping timeout: 248 seconds]
<RickHull> my approach is not to try to anticipate how to design rings 1-4 at the start. instead, nail down ring 0, and then see what is possible for ring 1
milardovich has joined #ruby
sunrunner20 has quit [Ping timeout: 260 seconds]
sunrunner20_ is now known as sunrunner20
<RickHull> if you are already a domain expert and you have the entire design in your head and somewhat "validated" then sure -- commit a big design up front for all rings, or make an uber-ring
<RickHull> so in my fork, in order to call Character.new, you have to have all the data, and the data will be validated or else Character.new will error out
nopolitica has joined #ruby
<RickHull> if you have no data and want full generation, call Character.generate. if you have partial data like name and gender, but want everything else generated, call Character.generate
<RickHull> Character.generate is flexible. Character.new is not
<RickHull> likewise, Character.new does not do any dice rolling. it assumes the character data has already been generated
<RickHull> Character.generate enforces the dice rolls for upp generation
<RickHull> but allows user-set values for plot, appearance, etc
ramortegui has joined #ruby
milardovich has quit [Ping timeout: 260 seconds]
muelleme has joined #ruby
sunrunner20 has quit [Quit: So Long and Thanks for All the fish]
nopolitica has quit [Ping timeout: 248 seconds]
quobo has joined #ruby
sunrunner20 has joined #ruby
Guest70176 has joined #ruby
muelleme has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
Guest70176 has quit [Ping timeout: 240 seconds]
thinkpad has joined #ruby
MrSparkle has quit [Ping timeout: 260 seconds]
LocaMocha is now known as MochaLoca
cschneid_ has joined #ruby
MrSparkle has joined #ruby
miskatonic has quit [Remote host closed the connection]
danielpclark has quit [Ping timeout: 268 seconds]
milardovich has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
cschneid_ has quit [Ping timeout: 248 seconds]
ShekharReddy has quit [Quit: Connection closed for inactivity]
enterprisey has joined #ruby
nowhere_man has joined #ruby
milardovich has quit [Ping timeout: 248 seconds]
biberu has quit []
rivalomega has quit [Remote host closed the connection]
eightlimbed has quit [Ping timeout: 240 seconds]
rivalomega has joined #ruby
John___ has joined #ruby
jenrzzz has joined #ruby
danielpclark has joined #ruby
vee__ has quit [Ping timeout: 258 seconds]
_sfiguser has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 248 seconds]
Guest59285 has quit [Remote host closed the connection]
Dimik has joined #ruby
zapata has joined #ruby
jenrzzz has joined #ruby
jottr has quit [Quit: WeeChat 1.9.1]
vee__ has joined #ruby
<leitz> apeiros, RickHull found a flaw in my logic. I'm working on it.
<leitz> RickHull, yeah, the core interface is mostly done. I was playing around with using the class differently but that didn't work. It was a learning experience though. :)
<weaksauce> leitz there are no flaws in logic just unexpected features
<RickHull> oh for sure
<RickHull> leitz: i'm hooked on redoing your core -- stay tuned to my fork
<RickHull> it's maybe worth playing around with already
<leitz> Keep in mind I'm an "early to bed, early to rise" sort. :)
axsuul has quit [Ping timeout: 250 seconds]
<RickHull> leitz: want to try it out?
<leitz> yup.
<RickHull> ok, go to a new dir, so you can clone my fork
<leitz> Same repo?
<RickHull> or if you're good with git, then you can add my fork as a remote
<RickHull> but for simplicity, just e.g. mkdir ~/tmp; cd ~/tmp
nopolitica has joined #ruby
axsuul has joined #ruby
<RickHull> once you're in the project dir, git checkout rickfactor
<RickHull> then: irb -Ilib -rtraveller_char/generator
<RickHull> Character.generate
<RickHull> er, TravellerChar::Character.generate
<RickHull> @appearance="medium straight brown neck hair with black skin" LOL
<RickHull> neck hair, sweet
<RickHull> we need a cheeto-dusted neckbeard
nopolitica has quit [Ping timeout: 240 seconds]
Rouge has joined #ruby
<leitz> RickHull, nice!
<leitz> Can't say I understand all of it yet though. :)
tomphp has quit [Read error: Connection reset by peer]
<RickHull> I added dice rolling to the generator module
<RickHull> if dice rolling is needed at playtime -- probably extract that back out again
<RickHull> but we're writing things to be flexible and composable so this will be easy later
<leitz> Using random is fine, or even sample from a range. Mostly just 2 six sided dice equivalent to give a curve in the middle.
<RickHull> the roll1 and rolln stuff was me just playing with lambdas -- not necessarily a good way to do it
tomphp has joined #ruby
Guest70176 has joined #ruby
<RickHull> in general, I prefer to express the calculation rather than step through it
<RickHull> declarative vs imperative
ta_ has quit [Remote host closed the connection]